pactbench / registry /status.py
BBoran's picture
Publish current portable PACTBench release
f1fc3a0 verified
Raw
History Blame Contribute Delete
3.73 kB
#!/usr/bin/env python3
"""Print the per-item status of all three games, straight from registry.json."""
from __future__ import annotations
import json
import os
os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
R = json.load(open("registry/registry.json"))
GAMES = list(R["games"])
MARK = {
"完成": "完成",
"未做": "未做",
"暂缓": "暂缓",
"外部执行": "外部执行",
"历史诊断": "历史诊断",
}
def main() -> None:
print("=" * 84)
print("PACT 实验逐项状态(三个游戏共用同一份实验块清单)")
print("=" * 84)
w = 26
print(f"\n{'实验块':<{w}}" + "".join(f"{R['games'][g]['display_name']:<18}" for g in GAMES))
print("-" * 84)
for blk in R["blocks"]:
row = f"{blk['name']:<{w}}"
for g in GAMES:
b = R["games"][g]["blocks"].get(blk["id"], {})
row += f"{MARK.get(b.get('status'), '—'):<18}"
print(row)
for g in GAMES:
extra = [b for bid, b in R["games"][g]["blocks"].items()
if bid not in {x["id"] for x in R["blocks"]}]
for b in extra:
row = f"{b.get('title', b.get('name', '?'))[:24]:<{w}}"
for gg in GAMES:
row += f"{(b['status'] if gg == g else '—'):<18}"
print(row)
print("\n" + "=" * 84)
print("数据集")
print("=" * 84)
for g in GAMES:
d = R["games"][g]["dataset"]
sp = d.get("split") or {}
tot = sp.get("total_fights")
line = f" {R['games'][g]['display_name']:<15}"
line += f"K̄={R['games'][g]['mean_menu_size_k']:<5} 随机基线={R['games'][g]['l2_chance_follow_pct']}%"
if tot:
line += f" fight: train {tot['train']} / val {tot['val']} / test {tot['test']}"
print(line)
print("\n" + "=" * 84)
print("已完成实验的产物与结果")
print("=" * 84)
for g in GAMES:
gd = R["games"][g]
print(f"\n### {gd['display_name']}")
for bid, b in gd["blocks"].items():
if b.get("status") != "完成":
continue
print(f" [{b.get('name', b.get('title'))}]")
for f in b.get("code", []):
print(f" code {f}")
if b.get("ckpt"):
c = b["ckpt"]
mb = (c["size_bytes"] or 0) / 2**20
print(f" ckpt {c['path']} ({mb:.0f}M)")
for key in ("cache_train", "cache_eval"):
if b.get(key):
c = b[key]
tag = "" if c["exists"] else " ← 已被清除,需重建"
print(f" {key:<7}{c['path']}{tag}")
h = b.get("headline")
if h and h.get("distance_mae") is not None:
print(f" 指标 n={h['n_eval']} dist_mae={h['distance_mae']} "
f"angle_mae={h['angle_mae_degrees']}° angle@20={h['angle_within_20']}")
for view, r in (b.get("runs") or {}).items():
hh = r.get("headline") or {}
print(f" L2 {view:<7} follow={hh.get('desc_follow_pct')}% "
f"({hh.get('x_chance')}× 随机) fights={hh.get('fights_covered')} {r['dir']}")
for a in b.get("artifacts", []):
print(f" 产物 {a['path']}")
if b.get("known_bug"):
print(f" ⚠️ {b['known_bug']}")
if b.get("finding"):
print(f" 结论 {b['finding']}")
for did, d in (gd.get("deprecated") or {}).items():
print(f" [废弃] {did}")
print(f" {d['reason']}")
if __name__ == "__main__":
main()