Datasets:
Download scripts/patch_v1_1.py from Netzerep/monitors-evaluation-awareness: direct link, hf CLI and curl.
- Browser
- Download file 2.84 kB
-
https://huggingface.co/datasets/Netzerep/monitors-evaluation-awareness/resolve/main/scripts/patch_v1_1.py
- Command line
-
hf download hf://datasets/Netzerep/monitors-evaluation-awareness/scripts/patch_v1_1.py
-
curl -L -o patch_v1_1.py https://huggingface.co/datasets/Netzerep/monitors-evaluation-awareness/resolve/main/scripts/patch_v1_1.py
2.84 kB
| # One-off patch of the dataset's v1.0 shards to v1.1 (lead, 2026-11-05): conclusion columns in the readout's kinds | |
| # (target_score + grader_rules -> grader; hedge folded by build_dataset.conclusion) and the prefill "hedge" condition | |
| # dropped. Same shards, schema and compression; rewrites build_report.json counts. | |
| # Usage: python patch_v1_1.py <dataset folder> | |
| import collections, glob, json, math, os, sys | |
| import pyarrow as pa, pyarrow.compute as pc, pyarrow.parquet as pq | |
| H = sys.argv[1] | |
| src = open(f"{H}/scripts/build_dataset.py").read() | |
| exec(src[src.index("CONCL_MERGE = {"):src.index("\n\n\n# ----", src.index("CONCL_MERGE = {"))]) # CONCL_MERGE, conclusion() | |
| rep = json.load(open(f"{H}/build_report.json")) | |
| cnt = dict(rows=0, setting=collections.Counter(), bench=collections.Counter(), mon=collections.Counter(), js=collections.Counter()) | |
| concl = collections.Counter(); dropped = 0 | |
| for f in sorted(glob.glob(f"{H}/data/reviews-*.parquet")): | |
| pf = pq.ParquetFile(f); t = pf.read(); n0 = t.num_rows | |
| rg = math.ceil(n0 / pf.metadata.num_row_groups) | |
| keep = pc.invert(pc.and_(pc.equal(t["setting"], "prefill"), pc.fill_null(pc.equal(t["prefill_condition"], "hedge"), False))) | |
| t = t.filter(keep); dropped += n0 - t.num_rows | |
| mains, alsos = t["vea_conclusion"].to_pylist(), t["vea_conclusions_also"].to_pylist() | |
| new = [conclusion({"main": m, "also": a}) if m is not None else (None, a) for m, a in zip(mains, alsos)] | |
| i = t.schema.get_field_index("vea_conclusion"); t = t.set_column(i, t.schema.field(i), pa.array([x[0] for x in new], t.schema.field(i).type)) | |
| i = t.schema.get_field_index("vea_conclusions_also"); t = t.set_column(i, t.schema.field(i), pa.array([x[1] for x in new], t.schema.field(i).type)) | |
| pq.write_table(t, f, compression="zstd", row_group_size=rg) | |
| cnt["rows"] += t.num_rows | |
| for k, col in (("setting", "setting"), ("bench", "benchmark"), ("mon", "monitor_model")): | |
| cnt[k].update(t[col].to_pylist()) | |
| cnt["js"].update(f"{s}/{j}" for s, j in zip(t["setting"].to_pylist(), t["judge_status"].to_pylist())) | |
| concl.update(x[0] for x in new if x[0]) | |
| rep.update(rows=cnt["rows"], rows_by_setting=dict(sorted(cnt["setting"].items())), rows_by_benchmark=dict(sorted(cnt["bench"].items())), | |
| rows_by_monitor=dict(sorted(cnt["mon"].items())), judge_status=dict(sorted(cnt["js"].items())), | |
| bytes=sum(os.path.getsize(f) for f in glob.glob(f"{H}/data/reviews-*.parquet")), | |
| v1_1_patch="2026-11-05: conclusion columns in the readout's kinds; prefill condition 'hedge' dropped (%d rows)" % dropped) | |
| json.dump(rep, open(f"{H}/build_report.json", "w"), indent=1, sort_keys=True) | |
| print("dropped", dropped, "rows", cnt["rows"]); print(dict(concl)); print(json.dumps({k: rep[k] for k in ("rows_by_setting", "rows_by_monitor", "judge_status")}, indent=1)) | |