Download scripts/r5_ref/ref_step_smoke_iii.sh from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 2.12 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_ref/ref_step_smoke_iii.sh
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_ref/ref_step_smoke_iii.sh
-
curl -L -o ref_step_smoke_iii.sh https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_ref/ref_step_smoke_iii.sh
2.12 kB
| # R5 REF, smoke test of the (iii) runs (mix_v1) with a stand-in mix: list builder, R1(iii) and R2(iii) for a few steps on the CPU, one resume each, predictions. | |
| 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/iii $T/R1_iii $T/R2_iii $T/preds_iii | |
| mkdir -p $T/iii | |
| echo "== list builder on the stand-in mix" | |
| $C/.venv_kraken/bin/python -I $S/ref_make_mix_lists.py $S/mix_smoke.yaml $T/iii --n 640 | |
| head -3 $T/iii/mix_iii_R1.tsv | |
| export TF_CPP_MIN_LOG_LEVEL=2 OMP_NUM_THREADS=4 | |
| PY=$C/.venv_ref_tf/bin/python | |
| echo "== R1(iii): 12 batches of 4 (smoke), stop, resume to the end" | |
| $PY -I $S/ref_flor_train.py --run iii --mix_list $T/iii/mix_iii_R1.tsv --refdata $T/iii --out $T/R1_iii --cpu --smoke_pool 64 --batch 4 --steps_per_epoch 4 --epochs 4 --max_steps 6 --workers 2 --resume | |
| $PY -I $S/ref_flor_train.py --run iii --mix_list $T/iii/mix_iii_R1.tsv --refdata $T/iii --out $T/R1_iii --cpu --smoke_pool 64 --batch 4 --steps_per_epoch 4 --epochs 4 --workers 2 --resume | |
| ls $T/R1_iii | |
| head -30 $T/R1_iii/train_summary.json | |
| $PY -I $S/ref_flor_predict.py --run iii --train_dir $T/R1_iii --refdata $T/iii --weights_file $T/R1_iii/curve_64.hdf5 --sets "V1=$M/kohtd_screen_v1.tsv" --limit 20 --cpu --workers 2 --pred_root $T/preds_iii --batch 8 --no_beam | |
| head -3 $T/preds_iii/R1/mix/V1.tsv | |
| echo "== R2(iii): 4 epochs of 2 iterations (smoke), stop after 2, resume" | |
| export OMP_NUM_THREADS=4 FLAGS_allocator_strategy=auto_growth | |
| PP=$C/.venv_ref_paddle_cpu/bin/python | |
| $PP -I $S/ref_ppocr_run.py --run iii --out $T/R2_iii --refdata $T/iii --cpu --smoke_n 64 --batch 8 --workers 2 --max_epochs_smoke_stop 2 --resume | |
| $PP -I $S/ref_ppocr_run.py --run iii --out $T/R2_iii --refdata $T/iii --cpu --smoke_n 64 --batch 8 --workers 2 --resume | |
| head -30 $T/R2_iii/train_summary.json | |
| ls $T/R2_iii/model | |
| $PP -I $S/ref_ppocr_predict.py --run iii --train_dir $T/R2_iii --sets "V1=$M/kohtd_screen_v1.tsv" --limit 20 --cpu --pred_root $T/preds_iii --batch 8 || true | |
| head -3 $T/preds_iii/R2/mix/V1.tsv || true | |