Download scripts/r5_testpass2/tp2_amend7.py from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 2.53 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_amend7.py
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_testpass2/tp2_amend7.py
-
curl -L -o tp2_amend7.py https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_amend7.py
2.53 kB
| """Appends 'amendment 6' (26 Nov 2026; plan entry n 7) to records/R5/TESTPASS2/plan.json BEFORE its predictions. | |
| usage: tp2_amend7.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_az_latin.py", "tp2_azlatin.sbatch", "tp2_qwen_az_script.py")} | |
| amend = { | |
| "n": 7, "title": "amendment 6 of the request of 26 Nov 2026 (owner-requested test of why Azerbaijani fails)", | |
| "utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "previous_plan_sha256": prev, "before_any_of_its_predictions": True, | |
| "status": "DESCRIPTIVE; changes no model choice; deadline 04:45Z", | |
| "hypothesis": ("if Latin-only decoding cuts M1's az_localdoc CER a lot (from 63.6% toward the 31-37% of PP-OCRv6), the script swap is " | |
| "the main cause; if not, the model also fails to read the letter shapes"), | |
| "test": ("M1 (checkpoints/r5/paddleocr_vl_1_6/leader, file hashes in plan models.M1) on all 442 az_localdoc_test lines, the same " | |
| "decoding as its test pass 2 run (training instruction, greedy, cap 192 for lines, batch 16, bf16 on CPU, manifest order) plus " | |
| "one logits processor that masks every vocabulary token whose decoded text contains a Cyrillic-only character and the byte-" | |
| "fallback tokens <0xD0>..<0xD4> (tp2_az_latin.py); ZEN4, 32 CPUs. Throughput: the test pass 2 run read the 442 lines in 237 s on " | |
| "16 CPUs, so all 442 fit before 04:40Z and no subset is drawn (the 150-line subset rule with seed 20261126 is not needed)."), | |
| "scoring": ("R5 score.py unchanged (--test-pass, test pass 2 gate, B 10000, seed 20261121, --settle 0), plain-profile CER with the " | |
| "source-page cluster bootstrap; paired with M1's unconstrained test pass 2 predictions on the same 442 rows " | |
| "(r5eval.stats.paired_ratio_difference on the scorer's per-page sums); Cyrillic share of output letters (expected 0) and " | |
| "the S/D/I breakdown (tp2_qwen_az_script.py, the measures of error_analysis.json)"), | |
| "code_sha256": code, | |
| } | |
| plan["amendments"].append(amend) | |
| plan["version"] = "1.7" | |
| json.dump(plan, open(p, "w", encoding="utf-8"), indent=1, ensure_ascii=False) | |
| print("amended", p, hashlib.sha256(open(p, "rb").read()).hexdigest()) | |