"""Appends amendment 4 (owner-authorized label-free re-score of M2 on the KOHTD sealed test) to records/R5/TESTPASS2/plan.json, before any prediction on kohtd_test. usage: tp2_amend4.py TESTPASS2_DIR """ import hashlib import json import os import sys import time TP = sys.argv[1] p = os.path.join(TP, "plan.json") plan = json.load(open(p, encoding="utf-8")) prev = hashlib.sha256(open(p, "rb").read()).hexdigest() code = {f: hashlib.sha256(open(os.path.join(TP, "code", f), "rb").read()).hexdigest() for f in ("tp2_a1_labelfree.py", "tp2_a1lf_kohtd.sbatch", "tp2_kohtd_compare.py")} amend = { "n": 4, "utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "previous_plan_sha256": prev, "before_any_prediction_on_kohtd_test_in_this_pass": True, "why": "the owner authorized a re-score of M2 (PP-OCRv6 medium, A1) on the KOHTD sealed test with the label-free setting (25 Nov 2026)", "model": ("release package DATA/release/rc1/turkic-ocr-ppocrv6-medium/infer.py unchanged (sha256 8910dc99...), imported by tp2_a1_labelfree.py " "exactly as in job 55280: --sort width --batch-pad 256, batch 32, CPU float32; one forward pass, greedy CTC and gated character " "LM (alpha 0.40, beta 1.00). The setting was chosen on V1 (6.48% greedy, 4.82% gated LM) before any test read."), "gate": "the job first re-runs V1 and stops unless greedy is within 0.001 of 0.0648 and gated LM within 0.001 of 0.0482 (as job 55280)", "set": ("kohtd_test, all 18,615 crops (manifest sha256 18deca78...), predicted ONCE; the unseen-word slices are slices of that one run, as the 24 " "Nov verdict scored them: slice:P2 (the verdict's recomputation from K_train, 2,228 crops), slice:registry_P2 (2,558 crops, the registered " "kohtd_test_p2), slice:P2b (recomputed) and slice:registry_P2b (2,105 crops, scored on 24 Nov). The registered kohtd_test_p2/p2b " "manifests are not predicted separately."), "scoring": ("R5 scorer score.py unchanged (r5eval code 9d5f3205...), --test-pass with the test pass 2 gate; profile repaired_refs (references " "repaired with the frozen look-alike table, verdict.json refs_reading 'repaired') is the primary reading, plain secondary"), "comparison": ("tp2_kohtd_compare.py: CER with the scorer's 95% form-bootstrap interval for M1 (the final model's EXISTING 24 Nov kohtd_test " "predictions, DATA/outputs/r5/preds/paddleocr_vl_1_6/leader, not re-run), M2 label-free greedy and gated LM, and the 24 Nov " "label-length M2 figures (kept in the record, marked as leaking reference length); paired difference M1 minus M2 by " "r5eval.stats.paired_ratio_difference, form bootstrap, B 10000, seed 20261121 (the scorer's and the verdict's default " "seed; recomputing clause 4.a with this function gives d_rel -0.19754 [-0.23149, -0.16293] on P1 and -0.12077 [-0.19002, " "-0.04925] on P2, identical to verdict.json)"), "sensitivity": "every number again without test form 1868 (cluster kohtd_form_1868; it duplicates validation form 951); sensitivity only", "failure_rule": "if the job fails mid-run, only the failed step is rerun with the same settings, logged in jobs.json", "running": "one ZEN4 job (16 CPUs, 64 GB)", "code_sha256": code, } plan["amendments"].append(amend) plan["version"] = "1.4" json.dump(plan, open(p, "w", encoding="utf-8"), indent=1, ensure_ascii=False) print("amended", p, hashlib.sha256(open(p, "rb").read()).hexdigest())