five-desks-control / source /scripts /inspect_calibration.py
rca-umb's picture
Five Desks v5 collapse test (positive control)
ab59633 verified
Raw History Blame Contribute Delete
1.12 kB
"""Show submitted answers next to expected answers for calibration episodes.
Usage: python scripts/inspect_calibration.py reports/calibration/<run>/episodes.jsonl [task-prefix]
"""
import json
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
sys.path.insert(0, str(Path(__file__).resolve().parent))
from calibrate import first_json_object # noqa: E402
from five_desks.tasks import build # noqa: E402
path = sys.argv[1]
prefix = sys.argv[2] if len(sys.argv) > 2 else ""
for line in open(path):
ep = json.loads(line)
if not ep["task_id"].startswith(prefix) or "seed" not in ep:
continue
inst = build(ep["task_id"], ep["seed"])
want = {p.key: p.expected for p in inst.parts}
got = first_json_object(ep["turns"][-1]["reply"]) if ep["turns"] else None
got = (got or {}).get("answer", got)
tools = [(first_json_object(t["reply"]) or {}).get("tool", "?") for t in ep["turns"]]
print(f"{ep['task_id']} seed={ep['seed']} reward={ep['reward']} end={ep['end']} tools={tools}")
print(f" expected {want}\n got {got}")