"""v6 pilot: 96 positions, 150 iters, PT + IT variants, results pushed to hub (so container rebuilds cannot eat them). Conditions A/B/D/E/G with heldout CE. """ import json, os, subprocess, sys, time # reuse run_pilot via subprocess for each variant; then upload both JSONs here = os.path.dirname(os.path.abspath(__file__)) PY = sys.executable for tag, model in (("pt", "google/gemma-3-270m"), ("it", "google/gemma-3-270m-it")): out_json = f"runs/gemma_pilot_v6_{tag}.json" cmd = [PY, os.path.join(here, "run_pilot.py"), "--model", model, "--hf-checkpoint", "fast_wide/latest.pt", "--positions", "96", "--iters", "150", "--out", out_json] print("=== variant", tag, "===", flush=True) r = subprocess.run(cmd, cwd="/app", capture_output=False) print(f"variant {tag} rc={r.returncode}", flush=True) # push the result to the hub if os.path.exists(out_json): try: from huggingface_hub import HfApi api = HfApi(token=os.environ.get("HF_TOKEN")) api.upload_file(path_or_fileobj=out_json, path_in_repo=f"gemma_pilot/v6_{tag}.json", repo_id="cazyundee/tinychess-ckpt", repo_type="model") print(f"pushed {out_json} -> gemma_pilot/v6_{tag}.json", flush=True) except Exception as e: print(f"push failed: {type(e).__name__}", flush=True) print("V6 PILOT ALL VARIANTS COMPLETE", flush=True)