#!/usr/bin/env python3 """Load the paper-scope slice of the private AAAI_Wrong-but-Useful archive. PRIVATE REPO: run `hf auth login` first, or this fails with 401/403. """ import pyarrow.compute as pc import pyarrow.dataset as ds from huggingface_hub import snapshot_download REPO = "AgentsSci/AAAI_Wrong-but-Useful" # The paper-scope filter. All three clauses matter: # protocol_id -- the archive is a five-protocol superset # paper_analysis_eligible -- the strict complete-LOO analysis view # actor_model_id -- belt-and-braces; excludes evaluator-only gemma3_27b PAPER = ((pc.field("protocol_id") == "dhd") & (pc.field("paper_analysis_eligible") == True) # noqa: E712 & (pc.field("actor_model_id").isin(["gemma_4_31b", "gpt_oss_120b"]))) def main() -> None: root = snapshot_download( REPO, repo_type="dataset", allow_patterns=["data/labels/interventional_credit/**", "registry/*.parquet"], ) credit = ds.dataset(f"{root}/data/labels/interventional_credit", format="parquet", partitioning="hive") print(f"all rows : {credit.count_rows():>9,} credit labels") print(f"paper scope : {credit.count_rows(filter=PAPER):>9,} credit labels") for scope, unit in [("committee_hypothesis", "LOO removal events"), ("individual_hypothesis", "hypotheses")]: n = credit.count_rows(filter=PAPER & (pc.field("credit_scope") == scope)) print(f" {scope:<22}: {n:>9,} {unit}") if __name__ == "__main__": main()