SPB Git

spb/wp31_uqo

Public
1.8 KB · 29 lines python
1#!/usr/bin/env python2"""Build reproducibility/run_index.md from every run manifest found locally and on the listed nodes (read-only)."""3import glob, json, subprocess, sys4from pathlib import Path56NODES = sys.argv[1:] or ["M3U96a", "M3U96b", "M2U64", "M4M64c", "M4M64a", "M5M36", "M4BP48", "M4BP36", "m4mn"]7rows = {}8for mp in glob.glob("experiments/runs/*/manifest.json"):9    m = json.load(open(mp)); rows[m["run_id"]] = (m, "laptop")10for n in NODES:11    try:12        out = subprocess.run(["ssh", "-o", "ConnectTimeout=8", n, "cat ~/wp31/prisme-slm/experiments/runs/*/manifest.json 2>/dev/null | python3 -c 'import sys,json; d=sys.stdin.read().replace(\"}\\n{\",\"}\\x00{\"); print(\"\\x00\".join(d.split(\"\\x00\")))'"],13                             capture_output=True, text=True, timeout=40).stdout14        for chunk in out.split("\x00"):15            chunk = chunk.strip()16            if chunk:17                try:18                    m = json.loads(chunk); rows.setdefault(m["run_id"], (m, n))19                except json.JSONDecodeError:20                    pass21    except Exception as e:  # noqa: BLE00122        print("skip", n, e)23lines = ["# Run index (auto-generated by scripts/run_index.py)", "", "| run_id | state | host | device | wall s | train tokens | peak mem (GB) | commit | notes |", "|---|---|---|---|---|---|---|---|---|"]24for rid, (m, where) in sorted(rows.items()):25    pm = m.get("peak_memory_bytes"); pm = f"{pm/1e9:.1f}" if isinstance(pm, (int, float)) and pm else ""26    lines.append(f"| {rid} | {m.get('state','')} | {where} | {m.get('device','')} | {m.get('wall_seconds','')} | {m.get('train_tokens','')} | {pm} | {str(m.get('code_commit',''))[:8]} | {m.get('mode','')} |")27Path("reproducibility/run_index.md").write_text("\n".join(lines) + "\n")28print(len(rows), "runs indexed")29
Files · a2c46f03643fdd75e8e87595931d35e18c590d57
Menu

Theme