Download scripts/r5_testpass2/tp2_amend6.py from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 4.5 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_amend6.py
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_testpass2/tp2_amend6.py
-
curl -L -o tp2_amend6.py https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_amend6.py
4.5 kB
| """Appends 'amendment 5' (26 Nov 2026; stored as entry n 6 because entry 5 is the scoring-repair log note) to | |
| records/R5/TESTPASS2/plan.json, BEFORE any of its predictions. | |
| usage: tp2_amend6.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 = {} | |
| for f in ("tp2_tob_read_vlm.py", "tp2_tob_ppocr.py", "tp2_qwen_az_script.py", "tp2_qwen.sbatch", "tp2_a5cpu.sbatch", "tp2_page_score.py", | |
| "tp2_a1_labelfree.py"): | |
| fp = os.path.join(TP, "code", f) | |
| code[f] = hashlib.sha256(open(fp, "rb").read()).hexdigest() if os.path.exists(fp) else "missing" | |
| amend = { | |
| "n": 6, "title": "amendment 5 of the request of 26 Nov 2026 (owner asked to run the comparisons marked 'not run' / 'not measured')", | |
| "utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "previous_plan_sha256": prev, "before_any_of_its_predictions": True, | |
| "status": "DESCRIPTIVE; none of these changes the model choice; deadline for results 04:45Z", | |
| "steps": { | |
| "1_qwen_az_script": ("existing Qwen3-VL-2B az_localdoc_test predictions (preds/q_az_localdoc_test): share of output letters that are " | |
| "Cyrillic, share of rows with any Cyrillic letter, Latin->Cyrillic substitutions and swap pairs from the scorer's " | |
| "alignment (r5eval.align.align_ops, N0 text), exactly the measures of error_analysis.json (tp2_qwen_az_script.py)"), | |
| "2_ppocr_tob_hand_pages": ("PP-OCRv6 medium (A1 long2x, release package infer.py imported unchanged, sha256 8910dc99...) on the 50 " | |
| "TurkishOCR-Bench handwritten pages, ZEN4 CPU: the EXISTING test pass 2 detector boxes (pages/det_hand.jsonl), the " | |
| "same reading order and crop margins as tp2_tob_read.py, crops from the full-resolution page; label-free batching " | |
| "(--sort width --batch-pad 256, batch 32, CPU float32) over all crops of the 50 pages; greedy and gated LM (alpha " | |
| "0.40, beta 1.00); output NFC with whitespace collapsed, empty lines dropped (tp2_tob_ppocr.py); scored by " | |
| "tp2_page_score.py unchanged (M28 reading order, M29 order free, case-sensitive and Turkish case fold; bootstrap " | |
| "over source documents, B 10000, seed 20261121)"), | |
| "3_qwen_gpu": ("one H100 job (tp2_qwen, --time 02:00:00): Qwen3-VL-2B R5 leader (checkpoints/r5/qwen3_vl_2b/leader, the B2 checkpoint of " | |
| "the 24 Nov sealed pass; file hashes in plan models.Qwen3-VL-2B) with the same inference code and settings as its test pass " | |
| "2 runs (eval_vlm_test.py unchanged: training instruction, greedy, caps 48/192, batch 16, bf16), on CUDA instead of CPU " | |
| "(the smoke found CPU = GPU outputs on 80 of 80 validation rows). Order, smallest first: TurkishOCR-Bench handwritten pages " | |
| "(existing detector boxes, tp2_tob_read_vlm.py = tp2_tob_read.py with --short/--device arguments, otherwise identical), " | |
| "synth_typed_test (5,000), rukopys_test (6,172), synth_hand_test (10,000), school_test (25,293). Each set is written and " | |
| "scored as soon as it is complete; --deadline-utc 2026-11-26T04:36:00Z: a set not complete by then is 'not run' " | |
| "(written as .partial.tsv, never scored)."), | |
| "4_scoring": ("crops: CODE/scripts/r5eval/score.py unchanged with --test-pass and the test pass 2 gate, B 10000, seed 20261121, plain " | |
| "profile reported; --settle 0 so a file is scored right after it is written (settle only selects files, it does not change " | |
| "scores); pages: tp2_page_score.py as above. Results go to results.json and per_language.json under 'qwen_amendment5' and " | |
| "'ppocr_tob_pages'."), | |
| }, | |
| "gpu_slot": "to free a GPU slot, the detector retrain job 55687 (rel2_d5_yolo_s2) is cancelled on instruction; it resumes from last.pt later", | |
| "code_sha256": code, | |
| } | |
| plan["amendments"].append(amend) | |
| plan["version"] = "1.6" | |
| json.dump(plan, open(p, "w", encoding="utf-8"), indent=1, ensure_ascii=False) | |
| print("amended", p, hashlib.sha256(open(p, "rb").read()).hexdigest()) | |