Buckets:
| """Read progress without touching the experiment.""" | |
| import argparse | |
| from collections import Counter | |
| import json | |
| import math | |
| from pathlib import Path | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("run_dir", type=Path) | |
| parser.add_argument("--full-metrics", action="store_true", help="Include generated code and all per-batch metrics") | |
| args = parser.parse_args() | |
| root = args.run_dir.resolve() | |
| c = json.loads((root / "resolved_config.json").read_text()) | |
| log = root / "tinker_log" / c["experiment_name"] | |
| result = {"task": c["task"], "run_dir": str(root), "smoke": c["smoke"], | |
| "target_updates": c["updates"], "rollouts_per_batch": c["group_size"] * c["groups_per_batch"]} | |
| result["logical_rollouts"] = {} | |
| result["candidate_summary"] = {} | |
| for path in sorted((log / "function_analysis").glob("step_*.jsonl")): | |
| with path.open() as handle: | |
| rows = [json.loads(line) for line in handle if line.strip() and line.endswith("\n")] | |
| result["logical_rollouts"][path.stem] = len(rows) | |
| candidates = [row.get("candidate", {}) for row in rows] | |
| scores = [float(row["raw_score"]) for row in candidates if row.get("raw_score") is not None and math.isfinite(float(row["raw_score"])) and float(row.get("correctness") or 0) > 0] | |
| failures = Counter(str(row.get("msg") or "No diagnostic message") for row in candidates | |
| if float(row.get("correctness") or 0) <= 0) | |
| result["candidate_summary"][path.stem] = dict(valid=len(scores), best_raw_score=min(scores) if scores else None, | |
| failures=dict(failures)) | |
| result["complete_checkpoints"] = [p.parent.name for p in sorted((root / "checkpoints").glob("*/checkpoint_complete"))] | |
| for name in ("status.json", "processes.json", "verification.json"): | |
| if (root / name).is_file(): | |
| result[name] = json.loads((root / name).read_text()) | |
| recent_log = root / "launcher.log" | |
| if recent_log.is_file(): | |
| result["recent_training_log"] = recent_log.read_text(errors="replace").splitlines()[-12:] | |
| if (log / "metrics.jsonl").is_file(): | |
| # A writer may still be appending the last JSON line during a status read. | |
| with (log / "metrics.jsonl").open() as handle: | |
| rows = [line for line in handle if line.strip() and line.endswith("\n")] | |
| if rows: | |
| metrics = json.loads(rows[-1]) | |
| if not args.full_metrics: | |
| prefixes = ("time/", "optim/", "progress/", "kl/", "bootstrap/") | |
| names = {"step", "kl_policy_base", "env/all/total_episodes", "env/all/correctness", | |
| "env/all/raw_score/min", "env/all/raw_score/max", "env/all/reward/mean"} | |
| metrics = {k: v for k, v in metrics.items() if k in names or k.startswith(prefixes)} | |
| result["latest_metrics"] = metrics | |
| print(json.dumps(result, indent=2)) | |
Xet Storage Details
- Size:
- 2.84 kB
- Xet hash:
- fda620245a2319c7c3546530a53b2e5d17254fbd4f1228ceb6d9d1fae68fb90b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.