Download scripts/r5_testpass2/tp2_amend5.py from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 3 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_amend5.py
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_testpass2/tp2_amend5.py
-
curl -L -o tp2_amend5.py https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_amend5.py
3 kB
| """Appends note 5 (scoring repair of amendment 4, a log entry, not a change of design) and the record of the extra descriptive analyses | |
| requested, to records/R5/TESTPASS2/plan.json. | |
| usage: tp2_amend5.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() | |
| note = { | |
| "n": 5, "utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "previous_plan_sha256": prev, "kind": "log note (repair of a scoring step)", | |
| "scoring_repair_amendment_4": { | |
| "what_happened": ("job 55347 wrote the two kohtd_test prediction files at 10:17:27Z and ran the scorer at 10:17:29Z; score.py skips " | |
| "prediction files modified less than --settle 20 s earlier (it logged '0 files to score ... 2 in flight'), so it " | |
| "scored 0 files and the comparison step stopped on the missing score file. Not a path or glob mismatch."), | |
| "check": ("prediction files unchanged since 10:17:27Z; 18,616 lines each (header + 18,615 rows); the scorer's coverage: 18,615 " | |
| "manifest rows, 18,615 prediction rows, 0 missing, 0 ragged, 0 duplicate, 0 reference mismatches, complete"), | |
| "fix": ("job 55362 (10:18Z) re-ran ONLY the two failed steps with unchanged commands and settings: score.py on the existing files " | |
| "(scored 2, errors 0) and tp2_kohtd_compare.py; no prediction was re-run. This repairs the scoring step; it is not a second " | |
| "test pass. The comparison reproduced verdict clause 4.a exactly before reporting the label-free figures."), | |
| "note_written_after_the_repair": True}, | |
| "extra_descriptive_analyses_on_existing_predictions": [ | |
| "error analysis of az_localdoc_test and rukopys_test (tp2_error_analysis.py, jobs 55354 and 55365; the second run added the " | |
| "swap-pair counts; same predictions)", | |
| "RUKOPYS crop-to-label alignment review of 30 rows (tp2_rk_align_prep.py job 55355; judgements by viewing; checks.json rukopys_alignment)", | |
| "per-language table from existing score files (tp2_per_language.py, job 55362; per_language.json)"], | |
| "rule_slips_logged": ["sed -n inside ssh at about 06:00Z (reading det_prep.py lines)", | |
| "sed -n locally at about 10:02Z (reading align.py and textnorm.py lines)", | |
| "one shell heredoc into cat locally to write tp2_per_language.sbatch (a file write, not an interpreter)", | |
| "six-task limit exceeded twice: job 55227 (07:21:25-07:22:54Z) and job 55241 (07:30:46-07:30:49Z) each started " | |
| "while 6 tp2_test array tasks ran (7 at once)"], | |
| } | |
| plan["amendments"].append(note) | |
| plan["version"] = "1.5" | |
| json.dump(plan, open(p, "w", encoding="utf-8"), indent=1, ensure_ascii=False) | |
| print("amended", p, hashlib.sha256(open(p, "rb").read()).hexdigest()) | |