Datasets:
4.0.3: refuse to resume with more samples than the existing file has
Browse files- caibench_dynamics.py +4 -0
caibench_dynamics.py
CHANGED
|
@@ -800,6 +800,10 @@ def cmd_run(a):
|
|
| 800 |
for l in open(out):
|
| 801 |
if l.strip():
|
| 802 |
d = json.loads(l); done[d["item_id"]] = d
|
|
|
|
|
|
|
|
|
|
|
|
|
| 803 |
rows.sort(key=lambda r: r["variant_type"] != "base")
|
| 804 |
rowmap = {r["item_id"]: r for r in rows}
|
| 805 |
call = lambda msgs: with_retry(lambda: call_model(a.provider, a.model, msgs, a.temperature, a.max_tokens))
|
|
|
|
| 800 |
for l in open(out):
|
| 801 |
if l.strip():
|
| 802 |
d = json.loads(l); done[d["item_id"]] = d
|
| 803 |
+
short = [k for k, d in done.items() if len(d["samples"]) < a.samples]
|
| 804 |
+
if short:
|
| 805 |
+
raise SystemExit(f"{len(short)} items in {out} have fewer than {a.samples} samples; "
|
| 806 |
+
"resume with the original --samples or write to a new --out file")
|
| 807 |
rows.sort(key=lambda r: r["variant_type"] != "base")
|
| 808 |
rowmap = {r["item_id"]: r for r in rows}
|
| 809 |
call = lambda msgs: with_retry(lambda: call_model(a.provider, a.model, msgs, a.temperature, a.max_tokens))
|