EvalHarness/build/lib/evalharness/fingerprint/merge_fusion_reference.py
sora 370953729b Fix perf stats (wrong import path), per-repeat checkpoints, README
- perf_stats aggregator lives in eval/, not model/: the import failed
  silently and EVERY perf column was empty (not just ttft). Now warns
  on stderr instead of swallowing.
- repeats > 1 get their own checkpoint key (:rep2, :rep3, ...): repeat 2
  previously restored repeat 1's predictions and finished instantly with
  identical scores. rep1 keeps the legacy key (existing checkpoints still
  resume).
- repeats summary: report the MEAN score and aggregate time/tokens over
  ALL runs (was: last run only).
- README: six-benchmark command as the primary example.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-11 13:38:04 +00:00

31 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""Merge detector 16-cell ref + extra 10-cell ref -> 26-cell fp_fusion ref."""
import json, sys
from pathlib import Path
FP_REFERENCES = Path(__file__).resolve().parent / 'references'
def main():
model_key, det_file, extra_file = sys.argv[1], sys.argv[2], sys.argv[3]
det = json.load(open(FP_REFERENCES / det_file))
extra = json.load(open(extra_file))
cells = dict(det.get("cells", {}))
for cid, c in extra.get("cells", {}).items():
if cid not in cells:
cells[cid] = c
fused = {"formatVersion": 1, "protocol": "one-token/v1",
"model": det.get("model"), "collectedAt": det.get("collectedAt"),
"samplesPerCell": det.get("samplesPerCell", 25),
"postReasoning": det.get("postReasoning", False),
"meta": {"fusion": True,
"note": "26-cell fp_fusion reference: 16 detector + 10 fp-only cells.",
"sourceDetector": det_file, "sourceExtra": extra_file},
"cells": cells}
out = FP_REFERENCES / f"{model_key}_fusion_reference.json"
out.write_text(json.dumps(fused, ensure_ascii=False, indent=2), encoding="utf-8")
tot_v = sum(c["validCount"] for c in cells.values())
tot_t = sum(c["totalCount"] for c in cells.values())
extras = [k for k in sorted(cells) if k.startswith(("binary-", "day-of-week")) and k.endswith(":en")]
print(f"[{model_key}] {len(cells)} cells -> {out} | valid {tot_v}/{tot_t}")
print(f" extra_en cells: {extras}")
if __name__ == "__main__":
main()