Download ops/fetch_games.py from tchbcb/qwenjev: direct link, hf CLI and curl.
- Browser
- Download file 2.55 kB
-
https://huggingface.co/tchbcb/qwenjev/resolve/main/ops/fetch_games.py
- Command line
-
hf download hf://tchbcb/qwenjev/ops/fetch_games.py
-
curl -L -o fetch_games.py https://huggingface.co/tchbcb/qwenjev/resolve/main/ops/fetch_games.py
2.55 kB
| #!/usr/bin/env python3 | |
| """Bootstrap: cache all 25 public ARC-AGI-3 games locally (one-time, ~3 MB). | |
| python ops/fetch_games.py # -> ./environment_files/ | |
| python ops/fetch_games.py --dir /data/env # custom cache dir | |
| python ops/fetch_games.py --list # live game list from the API | |
| After this every eval/collection run uses OperationMode.OFFLINE (zero | |
| network, unlimited instances). No Kaggle account or competition rules are | |
| required: the arcade API issues an anonymous key automatically. (The | |
| kagglehub competition download needs a KGAT token + accepted rules; this | |
| toolkit path does not.) | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import sys | |
| import time | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| sys.path.insert(0, str(ROOT)) | |
| DEFAULT_GAMES = [ | |
| "ar25", "bp35", "cd82", "cn04", "dc22", "ft09", "g50t", "ka59", | |
| "lf52", "lp85", "ls20", "m0r0", "r11l", "re86", "s5i5", "sb26", | |
| "sc25", "sk48", "sp80", "su15", "tn36", "tr87", "tu93", "vc33", "wa30", | |
| ] | |
| def main() -> None: | |
| ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) | |
| ap.add_argument("--dir", default=str(Path(__file__).resolve().parents[1] / "environment_files")) | |
| ap.add_argument("--list", action="store_true", help="list games and exit") | |
| args = ap.parse_args() | |
| import arc_agi | |
| from arc_agi import OperationMode | |
| arc = arc_agi.Arcade(operation_mode=OperationMode.NORMAL, | |
| environments_dir=args.dir) | |
| try: | |
| live = [e.game_id.split("-")[0] for e in arc.get_environments()] | |
| except Exception as exc: | |
| print(f"[warn] API listing failed ({exc}); using static list") | |
| live = DEFAULT_GAMES | |
| ids = live or DEFAULT_GAMES | |
| if args.list: | |
| print("\n".join(ids)) | |
| print(f"-- {len(ids)} games available from the arcade API", file=sys.stderr) | |
| return | |
| print(f"cache dir: {args.dir}; {len(ids)} games") | |
| ok, fail = [], [] | |
| for gid in ids: | |
| t0 = time.time() | |
| try: | |
| env = arc.make(gid) | |
| if env is None: | |
| raise RuntimeError("make() returned None") | |
| ok.append(gid) | |
| print(f" {gid}: OK ({time.time() - t0:.1f}s)", flush=True) | |
| except Exception as exc: | |
| fail.append(gid) | |
| print(f" {gid}: FAIL {type(exc).__name__}: {exc}", flush=True) | |
| print(f"downloaded={len(ok)} failed={len(fail)}" + (f" {fail}" if fail else "")) | |
| sys.exit(1 if fail else 0) | |
| if __name__ == "__main__": | |
| main() | |