tkhersoft's picture
temp build/analysis scripts (54 py files) backup before prune
94da461 verified
Raw
History Blame Contribute Delete
2.43 kB
"""FINAL C1 + C3 run over the v6 dataset (the real dataset), using the CANONICAL
pipeline + record writers from scripts/run_dataeval.py so the emitted JSONL is
byte-for-byte the same schema a normal run produces (full per-sample `result` with
reasoning, majority/agreement, both C3 orientations, etc.).
Only difference from `python -m scripts.run_dataeval`: the confuser-trajectory loader
is pointed at trajectories_all_v6.jsonl instead of the n100 source, and we run C1 + C3
with 3-sample majority. C3 uses the (now canonical) DO/DON'T prompt.
Run from repo root:
python -u temp/story_remediation/unbundle/run_final_c1c3.py
Outputs -> temp/story_remediation/unbundle/final_c1c3/{C1,C3}.jsonl + summary.json
"""
from __future__ import annotations
import json
import sys
from pathlib import Path
import yaml
ROOT = Path(__file__).resolve().parents[3]
sys.path.insert(0, str(ROOT))
from datasetreview import pipelines as P # noqa: E402
from datasetreview.llm_client import make_judge # noqa: E402
from scripts import run_dataeval as R # noqa: E402
V6 = ROOT / "temp" / "story_remediation" / "unbundle" / "out" / "trajectories_all_v6.jsonl"
OUT = ROOT / "temp" / "story_remediation" / "unbundle" / "final_c1c3"
_ROWS = [json.loads(l) for l in open(V6, encoding="utf-8") if l.strip()]
# Point the canonical loader at v6 (return the full set regardless of level).
P.confuser_trajectories = lambda level: _ROWS
EXPS = ["C1", "C3"]
LEVELS = [100]
SAMPLES = 3
WORKERS = 8
def main() -> int:
cfg = yaml.safe_load((ROOT / "datasetreview" / "config.yaml").read_text(encoding="utf-8"))
judge = make_judge(cfg["model"])
OUT.mkdir(parents=True, exist_ok=True)
print(f"model={cfg['model'].get('label')} rows={len(_ROWS)} exps={EXPS} "
f"samples={SAMPLES} workers={WORKERS} -> {OUT}")
ctx = P.build_context(EXPS)
summary = []
for exp in EXPS:
pipe = P.PIPELINES[exp](ctx)
summary.append(R.run_pipeline(
pipe, LEVELS, judge=judge, out_dir=OUT, limit=None,
workers=WORKERS, samples=SAMPLES,
resume=True, resume_force=False, dry_run=False,
))
(OUT / "summary.json").write_text(json.dumps(summary, indent=2), encoding="utf-8")
print(f"\nSummary -> {OUT / 'summary.json'}")
return 0
if __name__ == "__main__":
raise SystemExit(main())