Download scripts/r5_linedet/h10_selftest.sh from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 1.82 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_linedet/h10_selftest.sh
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_linedet/h10_selftest.sh
-
curl -L -o h10_selftest.sh https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_linedet/h10_selftest.sh
1.82 kB
| # Self-test of the test-pass code path (clarification H10) on SMOKE data only: 100 KOHTD validation crops relabelled as a fake locked "test" set, a fake gate file | |
| # in a scratch folder. Checks: predict --test_pass and lm_decode --test_pass run without a cap, write meta_test_pass.json and leave meta.json alone, | |
| # lm_gate gates the new set. No real test file is opened. | |
| set -u | |
| DATA=/path/to/TURKIC_OCR_DATA | |
| LD=$DATA/outputs/r5/linedet | |
| PY=/path/to/TURKIC_OCR_CODE/.venv_kraken/bin/python | |
| T=$DATA/tmp/h10selftest | |
| rm -rf $T; mkdir -p $T/preds/A1/long_lm $T/topk | |
| unset HF_TOKEN HUGGING_FACE_HUB_TOKEN | |
| $PY -I -m linedet.h10_fake $DATA/data/processed/r5_linedet_smoke/kohtd_val_smoke.tsv $T/man_test.tsv | |
| echo '{"sets": [{"name": "fake_test", "manifest": "'$T'/man_test.tsv", "split": "test", "locked": true}]}' > $T/evalsets.json | |
| echo fake > $T/gate.txt | |
| # validation meta of the LM folder with the tuned alpha and beta (from the earlier smoke LM test) | |
| cp $LD/smoke_gpu/preds/A1/long_lm/meta.json $T/preds/A1/long_lm/meta.json | |
| echo "== predict --test_pass" | |
| $PY -I -m linedet.predict --arm A1 --ckpt long --ckpt_dir $LD/smoke_gpu3/ckpt --evalsets $T/evalsets.json --test_pass --gate_file $T/gate.txt --device cpu --workers 2 --pred_dir $T/preds --logit_dir $T/topk 2>&1 | grep -a -E "fake_test|REFUSED|Error|Traceback" | |
| ls $T/preds/A1/long | |
| echo "== lm_decode --test_pass (no cap)" | |
| $PY -I -m linedet.lm_decode --arm A1 --ckpt long --test_pass --gate_file $T/gate.txt --lm $LD/lmtest/char6.klm --codec $LD/smoke/codec_union.json --workers 4 --pred_dir $T/preds --logit_dir $T/topk 2>&1 | grep -a -E "fake_test|REFUSED|Error|Traceback|lm_gate" | |
| ls $T/preds/A1/long_lm $T/preds/A1/long_lm_gated 2>&1 | |
| wc -l $T/preds/A1/long/fake_test.tsv $T/preds/A1/long_lm/fake_test.tsv $T/preds/A1/long_lm_gated/fake_test.tsv | |
| echo "== done" | |