Download scripts/r5_testpass2/tp2_amend1.py from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_amend1.py
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_testpass2/tp2_amend1.py
-
curl -L -o tp2_amend1.py https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_amend1.py
1.91 kB
| """Appends amendment 1 (smoke-test outcome, before any test prediction) to records/R5/TESTPASS2/plan.json. | |
| usage: tp2_amend1.py TESTPASS2_DIR SMOKE_COMPARE_JSON | |
| """ | |
| import hashlib | |
| import json | |
| import os | |
| import sys | |
| import time | |
| TP, SC = sys.argv[1], sys.argv[2] | |
| p = os.path.join(TP, "plan.json") | |
| plan = json.load(open(p, encoding="utf-8")) | |
| prev = hashlib.sha256(open(p, "rb").read()).hexdigest() | |
| sm = json.load(open(SC, encoding="utf-8")) | |
| q = sm["crops"]["qwen3_vl_2b/hkr_val_s2000"]["cpu_seconds_per_row_incl_load"] | |
| amend = { | |
| "n": 1, "utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "previous_plan_sha256": prev, | |
| "before_any_test_prediction": True, | |
| "smoke_job": "55183 (ZEN4, 2026-11-25T06:11:01Z-06:12:32Z), validation rows only", | |
| "smoke_outcome": { | |
| "crops_cpu_vs_gpu": {k: {x: v[x] for x in ("rows_compared", "identical_raw", "cpu_vs_gpu_char_edits", "cpu_seconds_per_row_incl_load")} | |
| for k, v in sm["crops"].items()}, | |
| "detector_cpu_vs_gpu": sm["detector"], | |
| "page_pipeline": ("tp2 detector + reader + page scorer on 2 generated validation pages give the same per-page edit counts as " | |
| "records/R5/PAGECHK detB1 (route A stored GPU boxes): reading order 27 and 5, order free 13 and 5 edits"), | |
| "reading": "CPU bf16 outputs are identical to the stored H100 bf16 outputs on all 80 validation rows compared (M1 and Qwen)", | |
| }, | |
| "qwen_rule_applied": ("Qwen seconds per word row on hkr_val_s2000 = %s; x 5,043 = %.0f s <= 28,800 s, so hkr_test1 and hkr_test2 are run " | |
| "(array tasks 12-15)" % (q, q * 5043)), | |
| "changes": "none to code, decoding, sets or scoring", | |
| } | |
| plan["amendments"].append(amend) | |
| plan["version"] = "1.1" | |
| json.dump(plan, open(p, "w", encoding="utf-8"), indent=1, ensure_ascii=False) | |
| print("amended", p, hashlib.sha256(open(p, "rb").read()).hexdigest()) | |