File size: 1,082 Bytes
b78499d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | """Score the rows of one round with run.py at HEAD, without judge items, and cache them.
Usage: python3 cache.py DATA REPO ROUND. Writes DATA/report-work/ROUND.pkl with the rows (answers kept) and the
deterministic and parser metrics of each row. The judge items are added later from the rows.
"""
import json
import pathlib
import pickle
import sys
import time
sys.dont_write_bytecode = True
DATA, REPO = pathlib.Path(sys.argv[1]), pathlib.Path(sys.argv[2]) # the folder of the data, a clone of the repo at eb30ca8
S = DATA
sys.path.insert(0, str(REPO / "evals"))
import run # noqa: E402
name = sys.argv[3]
t = time.time()
spec = json.loads((REPO / "evals" / "cases.json").read_text(encoding="utf-8"))
settings = run.config.load(run.EVALS)
rows = run.read_rows(S / name / "results.jsonl")
det = run.score_rows(rows, spec, settings, "none-of-the-judges")
pickle.dump({"rows": rows, "det": det, "language_of": run.case_languages(spec, settings)},
open(S / "report-work" / f"{name}.pkl", "wb"))
print(name, len(rows), "rows", round(time.time() - t), "s", flush=True)
|