Download source/scripts/inspect_calibration.py from rca-umb/five-desks-control: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/datasets/rca-umb/five-desks-control/resolve/main/source/scripts/inspect_calibration.py
- Command line
-
hf download hf://datasets/rca-umb/five-desks-control/source/scripts/inspect_calibration.py
-
curl -L -o inspect_calibration.py https://huggingface.co/datasets/rca-umb/five-desks-control/resolve/main/source/scripts/inspect_calibration.py
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}") | |