Download scripts/r5_ref/ref_step_smoke_r2.sh from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 1.63 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_ref/ref_step_smoke_r2.sh
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_ref/ref_step_smoke_r2.sh
-
curl -L -o ref_step_smoke_r2.sh https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_ref/ref_step_smoke_r2.sh
1.63 kB
| # R5 REF, smoke test of R2 (PaddleOCR PP-OCRv3 recogniser) 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/R2_i $T/preds_r2 | |
| mkdir -p $T | |
| export OMP_NUM_THREADS=4 FLAGS_allocator_strategy=auto_growth | |
| PY=$C/.venv_ref_paddle_cpu/bin/python # CPU build of the same PaddlePaddle version: the CUDA wheel cannot be imported on a node without libcuda | |
| echo "== session 1: 2 epochs planned, stop cleanly after epoch 1 (saves latest)" | |
| $PY -I $S/ref_ppocr_run.py --run i --out $T/R2_i --cpu --smoke_n 64 --epochs 2 --batch 8 --workers 2 --max_epochs_smoke_stop 1 --resume | |
| cat $T/R2_i/train_summary.json | head -30 | |
| echo "== session 2: resume to the end" | |
| $PY -I $S/ref_ppocr_run.py --run i --out $T/R2_i --cpu --smoke_n 64 --epochs 2 --batch 8 --workers 2 --resume | |
| cat $T/R2_i/train_summary.json | head -30 | |
| ls -la $T/R2_i $T/R2_i/model $T/R2_i/best_keep | |
| echo "== predict" | |
| $PY -I $S/ref_ppocr_predict.py --run i --train_dir $T/R2_i --sets "V1=$M/kohtd_screen_v1.tsv" --limit 40 --cpu --pred_root $T/preds_r2 --batch 16 | |
| head -5 $T/preds_r2/R2/ours/V1.tsv | |
| $C/.venv_ref_tf/bin/python -I $S/ref_paper_metrics.py $T/preds_r2/R2/ours/V1.tsv $T/preds_r2/metrics_smoke.json | head -30 | |
| echo "== calibration path (short): speed measurement from PaddleOCR's own log" | |
| $PY -I $S/ref_ppocr_run.py --run i --out $T/R2_cal --cpu --smoke_n 64 --batch 8 --workers 2 --calib_s 60 --budget_s 600 | |
| cat $T/R2_cal/wrapper_state.json | |