"""collect.py name=job_id ... — one row per job: the 8-bit ONNX scores at the val-chosen threshold (last evaluate line).""" import os import sys import json import subprocess env = os.environ | {"HF_HUB_DISABLE_EXPERIMENTAL_WARNING": "1"} print("name".ljust(26), "thr ", " ".join(k.ljust(22) for k in ("val", "test(GLM)", "test_real", "hard"))) for arg in sys.argv[1:]: name, job = arg.split("=", 1) logs = subprocess.run(["hf", "jobs", "logs", job], capture_output=True, text=True, env=env).stdout lines = [line for line in logs.splitlines() if line.startswith('{"model')] if not lines: print(name.ljust(26), "no ONNX result") continue d = json.loads(lines[-1]) # model_qint8.onnx is evaluated last cells = [f"{d[k]['@val']['acc']:.1%} w{d[k]['@val']['wrong']} m{d[k]['@val']['missed']} s{d[k]['@val']['severe']}" for k in ("val", "test", "test_real", "hard")] print(name.ljust(26), f"{d['val_thr']:.2f} ", " ".join(c.ljust(22) for c in cells))