Download experiments/run_all.py from fahadhafeezofficial/clsa-code: direct link, hf CLI and curl.
- Browser
- Download file 3.73 kB
-
https://huggingface.co/datasets/fahadhafeezofficial/clsa-code/resolve/main/experiments/run_all.py
- Command line
-
hf download hf://datasets/fahadhafeezofficial/clsa-code/experiments/run_all.py
-
curl -L -o run_all.py https://huggingface.co/datasets/fahadhafeezofficial/clsa-code/resolve/main/experiments/run_all.py
3.73 kB
| # Copyright (c) 2026 CLSA contributors | |
| # SPDX-License-Identifier: MIT | |
| """Run E1-E9 and write results/INDEX.md linking result, config, seed and commit.""" | |
| from __future__ import annotations | |
| import json | |
| import sys | |
| import traceback | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src")) | |
| from clsa.eval.experiments import e1_main, e2_world_model, e3_budget, e4_calibration | |
| from clsa.eval.experiments import e5_causality, e6_transfer, e7_multimodal, e9_efficiency | |
| from clsa.eval.multiagent import e8_multiagent | |
| from clsa.util import RESULTS, git_commit, load_config, utc_now, write_result | |
| EXPERIMENTS = { | |
| "e1_main": ("E1 main comparison", e1_main), | |
| "e2_world_model": ("E2 world-model quality", e2_world_model), | |
| "e3_budget": ("E3 budget and Pareto", e3_budget), | |
| "e4_calibration": ("E4 calibration", e4_calibration), | |
| "e5_causality": ("E5 Tiwari dissociation", e5_causality), | |
| "e6_transfer": ("E6 held-out transfer", e6_transfer), | |
| "e7_multimodal": ("E7 multimodal / GUI split", e7_multimodal), | |
| "e8_multiagent": ("E8 multi-agent divergence", e8_multiagent), | |
| "e9_efficiency": ("E9 efficiency and distillation", e9_efficiency), | |
| } | |
| def main() -> None: | |
| cfg = load_config("controller") | |
| seed = int(cfg.get("seed", 0)) | |
| status = [] | |
| for name, (title, fn) in EXPERIMENTS.items(): | |
| try: | |
| payload = fn() | |
| payload.pop("raw_rows", None) | |
| write_result(name, payload, config=cfg, seed=seed, notes=title) | |
| status.append((name, title, "ok", "")) | |
| print(f"[ok] {name}") | |
| except Exception as exc: # noqa: BLE001 | |
| write_result( | |
| name, | |
| { | |
| "blocked": True, | |
| "error": f"{type(exc).__name__}: {exc}", | |
| "traceback": traceback.format_exc()[-2000:], | |
| }, | |
| config=cfg, | |
| seed=seed, | |
| notes=f"BLOCKED: {title}", | |
| ) | |
| status.append((name, title, "blocked", f"{type(exc).__name__}: {exc}")) | |
| print(f"[blocked] {name}: {exc}") | |
| lines = [ | |
| "# Results index", | |
| "", | |
| f"Generated {utc_now()} at commit `{git_commit()}`.", | |
| "", | |
| "Every row links a result file to its config, seed and commit. Blocked", | |
| "experiments are listed with their reason; they are never silently dropped.", | |
| "", | |
| "| Experiment | Result file | Config | Seed | Commit | Status |", | |
| "|---|---|---|---|---|---|", | |
| ] | |
| for name, title, st, err in status: | |
| path = RESULTS / f"{name}.json" | |
| rec = json.loads(path.read_text()) if path.exists() else {} | |
| lines.append( | |
| f"| {title} | `results/{name}.json` | `{rec.get('config_path', '')}` | " | |
| f"{rec.get('seed')} | `{(rec.get('git_commit') or '')[:8]}` | " | |
| f"{st}{(' - ' + err) if err else ''} |" | |
| ) | |
| lines += [ | |
| "", | |
| "## Reproduction notes", | |
| "", | |
| "- `make bench` rebuilds PreAct-Bench and audits it (schema + fork replay).", | |
| "- `make train` harvests activations, then trains the transcoder, probes,", | |
| " world model and risk head.", | |
| "- `make experiments` runs E1-E9 and rewrites this file.", | |
| "- `make figures` regenerates every figure from `results/`.", | |
| "", | |
| "## Pre-registration", | |
| "", | |
| "Committed at `7d3946a` before the main runs; see `PRE_REGISTRATION.md`.", | |
| "Deviations are recorded inside that file.", | |
| ] | |
| (RESULTS / "INDEX.md").write_text("\n".join(lines) + "\n", encoding="utf-8") | |
| print("wrote results/INDEX.md") | |
| if __name__ == "__main__": | |
| main() | |