turkic-ocr-code / scripts /r5_testpass2 /tp2_checks_extra.py
treoa's picture
Release 1
24aaa76
Raw History Blame Contribute Delete
3.46 kB
"""Adds 'm1_label_independence' and the runtime weight-hash check of the label-free M2 runs to records/R5/TESTPASS2/checks.json.
usage: tp2_checks_extra.py TESTPASS2_DIR
"""
import json
import os
import sys
TP = sys.argv[1]
p = os.path.join(TP, "checks.json")
C = json.load(open(p, encoding="utf-8"))
C["m1_label_independence"] = {
"verdict": "M1's batching, order, padding and token cap use no label information; no validation measurement is needed",
"run_checked": ("the 24 Nov M1 kohtd_test predictions (DATA/outputs/r5/preds/paddleocr_vl_1_6/leader/kohtd_test.tsv, pred sha256 "
"a768ec03fa68e8ac..., scored 2026-11-24T14:06:48Z) were made by CODE/scripts/r5_vlma/eval_vlm_test.py (meta.json test_pass: "
"script eval_vlm_test.py, batch 16, updated 12:08:43Z, gate sha256 caad5dc0...); that file (sha256 425bffba...) was last "
"modified 2026-11-23T21:32:32Z, and vlm_common.py (sha256 1730edbc...) 2026-11-21T08:44:56Z, both before the pass, so the "
"code read is the code that ran"),
"evidence": [
"order: eval_vlm_test.py line 198 reads the manifest in file order; kohtd_test.tsv is sorted by id string (18,615 unique ids of "
"the form <form>_<line>_<word>; checked); line 228 sorts only by unit (all rows 'word'; Python's sort is stable, so file order is kept)",
"batches: lines 229-237, consecutive groups of --batch 16 rows of that order",
"token cap: line 237 MAXNEW[u], vlm_common.py line 282 MAXNEW = {'word': 48, 'line': 192}: fixed per unit, not derived from the label",
"padding: text tokens are padded on the LEFT (eval_vlm_test.py line 117 tok.padding_side = 'left'; vlm_common.py line 116 "
"apply_chat_template(..., padding=True); asserted at vlm_common.py line 322); images are not padded to a common size: the "
"PaddleOCR-VL image processor concatenates per-image patch sequences with their grids (transformers models/paddleocr_vl/"
"image_processing_paddleocr_vl.py lines 264-265, torch.cat of processed images and image_grid_thw)",
"reference text: used only when read (vlm_common.py line 51, NFC) and when the prediction TSV is written after generation "
"(vlm_common.py line 437); no other use in eval_vlm_test.py",
"reuse: line 216/250 caches outputs by (image path, unit) so kohtd_test_p2/p2b rows reuse kohtd_test outputs: label-free",
"batch-companion dependence: the release check found M1 outputs identical with different batch companions (32 of 32, release-check "
"message); test pass 2 smoke: CPU = GPU outputs on 80 of 80 validation rows",
],
}
C.setdefault("hashes", {})["m2_labelfree_runtime_weights"] = {
"source": "meta.json of all 18 DATA/outputs/r5/testpass2/preds/m2lf_*/A1/*/ folders (hashes computed at run time by tp2_a1_labelfree.py)",
"infer_py": "8910dc991db5452ae9063bbc736b3464ca088553813b3bf147b1f507bc4bbee5",
"model_safetensors": "2dda8e465ecde4a98b8630f3ac98173341420bc9ab45bb59a83de2832746469f",
"codec_json": "49832a6c3630f0b6ef908d5d02e88bdf32fcd18fa2622fbe91a50dbe6a2afabf",
"char6_klm": "e5b596f9463c78250f5b8dcf58a75cdc1a90f29d20bd7ab0b2187a5c357902fb",
"all_18_folders_identical": True,
"equal_to_release_SHA256SUMS": True,
"char6_klm_equal_to_R5_LM": True,
}
json.dump(C, open(p, "w", encoding="utf-8"), indent=1, ensure_ascii=False)
print("checks.json extended")