Download code/rubric_gen/make_fast_split.py from EdwardoSunny/agent-cwm-rubrics-debug: direct link, hf CLI and curl.
- Browser
- Download file 6.34 kB
-
https://huggingface.co/datasets/EdwardoSunny/agent-cwm-rubrics-debug/resolve/main/code/rubric_gen/make_fast_split.py
- Command line
-
hf download hf://datasets/EdwardoSunny/agent-cwm-rubrics-debug/code/rubric_gen/make_fast_split.py
-
curl -L -o make_fast_split.py https://huggingface.co/datasets/EdwardoSunny/agent-cwm-rubrics-debug/resolve/main/code/rubric_gen/make_fast_split.py
6.34 kB
| #!/usr/bin/env python3 | |
| """A temporary split over only what is already on disk, weighted toward EVAL. | |
| python3 make_fast_split.py --out split_fast.json | |
| RUBRIC_GEN_SPLIT=$PWD/split_fast.json python3 run.py | |
| WHY | |
| The real manifest is 15 train / 60 eval, which is the right design. What | |
| actually finished downloading is the opposite shape -- 10 train against 6 eval | |
| -- because the train competitions happen to be the enormous ones (seti 245 GB, | |
| herbarium 149 GB) while the eval ones are small. Measuring against 6 held-out | |
| competitions when 10 are available for mining is backwards: rubric quality is | |
| bounded by how much held-out signal we can measure, not by how much we mined. | |
| So this builds a 4 train / 12 eval split over exactly the competitions on disk, | |
| to get a real held-out number today instead of after another ~500 GB of | |
| downloads. | |
| THE CORRECTNESS CATCH | |
| Competitions already mined under the real split CANNOT simply be relabelled as | |
| eval. Rubrics exist that were derived from them, and scoring those rubrics on | |
| their own source data reports memorization as transfer. The only sound way to | |
| shrink the train side is to shrink it and REGENERATE -- so `--train` picks the | |
| new source set, and everything mined previously must be discarded and rebuilt | |
| from just those. The script prints that instruction rather than assuming it. | |
| TRAIN SELECTION | |
| Four competitions spanning four input modalities -- tabular, text, natural | |
| image, medical image. Diversity matters more than count here: rubrics mined | |
| from four different kinds of task generalize better than from eight variants of | |
| one, and the earlier run showed a single competition's idioms dominating the | |
| output when the corpus was narrow. | |
| Its experiment_id is `rubric-gen-fast-signal`, stamped into every artifact, | |
| audit report and result file produced under it -- so a number from this split | |
| can never be quietly presented as a number from the real one. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import sys | |
| from pathlib import Path | |
| HERE = Path(__file__).resolve().parent | |
| sys.path.insert(0, str(HERE)) | |
| import split as split_mod | |
| DATA_DIR = Path("/workspace/edwardosunny/mle-bench/data") | |
| # One per modality, all small enough to re-mine quickly. | |
| DEFAULT_TRAIN = [ | |
| "tabular-playground-series-dec-2021", # tabular | |
| "spooky-author-identification", # text classification | |
| "dog-breed-identification", # natural image, fine-grained | |
| "osic-pulmonary-fibrosis-progression", # medical image + tabular regression | |
| ] | |
| def prepared(data_dir: Path, comp: str) -> bool: | |
| pub = data_dir / comp / "prepared" / "public" | |
| return pub.is_dir() and any(pub.iterdir()) | |
| def main() -> int: | |
| ap = argparse.ArgumentParser(description=__doc__, | |
| formatter_class=argparse.RawDescriptionHelpFormatter) | |
| ap.add_argument("--data-dir", default=str(DATA_DIR)) | |
| ap.add_argument("--train", default=",".join(DEFAULT_TRAIN)) | |
| ap.add_argument("--out", default=str(HERE / "split_fast.json")) | |
| args = ap.parse_args() | |
| data_dir = Path(args.data_dir) | |
| real = split_mod.Split(split_mod.load_manifest(HERE / "split_manifest.json")) | |
| universe = real.source + real.evaluation | |
| on_disk = [c for c in universe if prepared(data_dir, c)] | |
| train = [c.strip() for c in args.train.split(",") if c.strip()] | |
| missing = [c for c in train if c not in on_disk] | |
| if missing: | |
| raise SystemExit(f"requested train competitions are not prepared: {missing}") | |
| evaluation = [c for c in on_disk if c not in set(train)] | |
| if not evaluation: | |
| raise SystemExit("no evaluation competitions left on disk") | |
| manifest = { | |
| "experiment_id": "rubric-gen-fast-signal", | |
| # Frozen because it IS fixed once written, and because | |
| # split.get(strict=True) -- which every mining entry point uses -- | |
| # refuses an unfrozen manifest. Marking it False would have blocked the | |
| # very run it exists for. The guard against mistaking this for the real | |
| # thing is the experiment_id, stamped into every artifact and audit. | |
| "frozen": True, | |
| "purpose": "Early signal over only the competitions already downloaded. " | |
| "Weighted toward eval because held-out measurement, not " | |
| "mining volume, is what bounds the result right now.", | |
| "supersedes_nothing": "The real split is split_manifest.json (15/60). " | |
| "This one covers only what is on disk.", | |
| "selection": { | |
| "train": "four competitions, one per input modality -- tabular, " | |
| "text, natural image, medical image. Diversity beats count: " | |
| "a narrow corpus lets one competition's idioms dominate.", | |
| "eval": "every other prepared competition.", | |
| }, | |
| "warning": "Rubrics previously mined under the real split were derived " | |
| "from competitions that are EVAL here. They must be " | |
| "regenerated from this train set before any measurement, or " | |
| "the result reports memorization as transfer.", | |
| "counts": {"train": len(train), "eval": len(evaluation), | |
| "train_fraction": round(len(train) / len(on_disk), 4)}, | |
| "source_competitions": [{"id": c} for c in sorted(train)], | |
| "evaluation_competitions": [{"id": c} for c in sorted(evaluation)], | |
| } | |
| Path(args.out).write_text(json.dumps(manifest, indent=2) + "\n") | |
| print(f"{len(on_disk)} competitions on disk -> {len(train)} train / " | |
| f"{len(evaluation)} eval " | |
| f"({100*len(train)/len(on_disk):.0f}% / " | |
| f"{100*len(evaluation)/len(on_disk):.0f}%)") | |
| print("\nTRAIN (mine rubrics from these):") | |
| for c in sorted(train): | |
| print(f" {c}") | |
| print("\nEVAL (measure on these):") | |
| for c in sorted(evaluation): | |
| was = "was train in the real split" if real.is_source(c) else "" | |
| print(f" {c:52s} {was}") | |
| print(f"\n-> {args.out}") | |
| print("\nREGENERATE before measuring -- existing rubrics were mined from " | |
| "competitions that are EVAL here:") | |
| print(f" export RUBRIC_GEN_SPLIT={args.out}") | |
| print(" rm -f data/states.jsonl data/conceptual_*.jsonl out/*/*.md") | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |