Download scripts/r5_ref/ref_step_smoke_r1.sh from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_ref/ref_step_smoke_r1.sh
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_ref/ref_step_smoke_r1.sh
-
curl -L -o ref_step_smoke_r1.sh https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_ref/ref_step_smoke_r1.sh
1.5 kB
| # R5 REF, smoke test of R1 (HTR-Flor, TensorFlow) on the CPU: a few steps, one save, one resume, one prediction pass (no GPU, no test data). | |
| set -eu | |
| unset HF_TOKEN HUGGING_FACE_HUB_TOKEN | |
| C=/path/to/TURKIC_OCR_CODE | |
| D=/path/to/TURKIC_OCR_DATA | |
| S=$C/scripts/r5_ref | |
| T=$D/tmp/ref_smoke | |
| M=$D/data/processed/r5/manifests | |
| rm -rf $T/R1_i $T/preds_r1 | |
| mkdir -p $T | |
| export TF_CPP_MIN_LOG_LEVEL=2 OMP_NUM_THREADS=4 | |
| PY=$C/.venv_ref_tf/bin/python | |
| echo "== session 1: 12 batches, then stop and save" | |
| $PY -I $S/ref_flor_train.py --run i --out $T/R1_i --cpu --smoke_pool 400 --batch 4 --steps_per_epoch 5 --max_steps 12 --workers 2 --resume | |
| cat $T/R1_i/train_summary.json | head -30 | |
| echo "== session 2: resume, up to 25 batches" | |
| $PY -I $S/ref_flor_train.py --run i --out $T/R1_i --cpu --smoke_pool 400 --batch 4 --steps_per_epoch 5 --max_steps 25 --workers 2 --resume | |
| cat $T/R1_i/train_summary.json | head -30 | |
| echo "== predict" | |
| $PY -I $S/ref_flor_predict.py --run i --train_dir $T/R1_i --sets "V1=$M/kohtd_screen_v1.tsv" --limit 40 --cpu --workers 2 --pred_root $T/preds_r1 --batch 16 | |
| head -5 $T/preds_r1/R1/ours/V1.tsv | |
| head -5 $T/preds_r1/R1/ours_paperdec/V1.tsv | |
| $PY -I $S/ref_paper_metrics.py $T/preds_r1/R1/ours/V1.tsv $T/preds_r1/metrics_smoke.json | head -30 | |
| echo "== refusal test (a locked set must be refused without the token file)" | |
| $PY -I $S/ref_flor_predict.py --run i --train_dir $T/R1_i --sets "kohtd_rand_test=$M/kohtd_rand_test.tsv" --limit 3 --cpu --pred_root $T/preds_r1 2>&1 | tail -2 || true | |