File size: 4,367 Bytes
24aaa76 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/bin/bash
#SBATCH --job-name=tp2_qwen
#SBATCH --partition=H100
#SBATCH --qos=nu-h100
#SBATCH --gres=gpu:h100:1
#SBATCH --cpus-per-task=16
#SBATCH --mem=96G
#SBATCH --time=02:00:00
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out
# Test pass 2, plan amendment 5 of 26 Nov (plan entry n 6): Qwen3-VL-2B R5 leader on CUDA with the test pass 2 inference code, smallest set
# first; each set scored as soon as it is complete (scoring in the background on this node's CPUs). Descriptive.
set -u
CODE=/path/to/TURKIC_OCR_CODE
D=/path/to/TURKIC_OCR_DATA
T=$D/outputs/r5/testpass2
S=$CODE/scripts/r5_testpass2
V=$CODE/scripts/r5_vlma
G=$T/GATE_testpass2_started.txt
Q=$D/checkpoints/r5/qwen3_vl_2b/leader
DL=2026-11-26T04:36:00Z
REG=$D/data/processed/r5/evalsets.json
export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 TOKENIZERS_PARALLELISM=false
hostname; date -u; nvidia-smi --query-gpu=name,memory.total --format=csv
if [ ! -f $T/plan_amendment6_copied.txt ]; then echo "REFUSED: amendment not copied"; exit 3; fi
mkdir -p $T/pages $T/no_page_preds
# 1. TurkishOCR-Bench handwritten pages (existing detector boxes)
$CODE/.venv_vlm/bin/python -I $S/tp2_tob_read_vlm.py --short qwen3_vl_2b --device cuda --pages $T/tob/pages_hand.tsv --det $T/pages/det_hand.jsonl \
--model $Q --out $T/pages/read_hand_qwen.jsonl --gate-file $G
echo "=== tob pages exit $? $(date -u +%FT%TZ)"
OMP_NUM_THREADS=1 $CODE/.venv_kraken/bin/python -I $S/tp2_page_score.py --pages $T/tob/pages_hand.tsv --pred $T/pages/read_hand_qwen.jsonl \
--label tob_hand_qwen --gate-file $G --out $T/pages/page_score_tob_hand_qwen.json
echo "=== tob pages score exit $? $(date -u +%FT%TZ)"
# 2. crop sets, smallest first
$CODE/.venv_vlm/bin/python -I $V/eval_vlm_test.py --short qwen3_vl_2b --model-dir $Q --registry $V/models_r5.tsv --arm qwen3_vl_2b --ckpt leader \
--evalsets $REG --preds-root $T/preds/q_synth_typed_test --sets synth_typed_test --test-pass --gate-file $G --batch 16 --deadline-utc $DL --device cuda
echo "=== synth_typed_test exit $? $(date -u +%FT%TZ)"
(OMP_NUM_THREADS=1 $CODE/.venv_kraken/bin/python -I $CODE/scripts/r5eval/score.py --preds $T/preds/q_synth_typed_test --registry $REG \
--out $T/scores/q_synth_typed_test --workers 2 --test-pass --gate-file $G --page-preds $T/no_page_preds --settle 0; echo "=== score synth_typed_test exit $? $(date -u +%FT%TZ)") &
$CODE/.venv_vlm/bin/python -I $V/eval_vlm_test.py --short qwen3_vl_2b --model-dir $Q --registry $V/models_r5.tsv --arm qwen3_vl_2b --ckpt leader \
--evalsets $REG --preds-root $T/preds/q_rukopys_test --sets rukopys_test --test-pass --gate-file $G --batch 16 --deadline-utc $DL --device cuda
echo "=== rukopys_test exit $? $(date -u +%FT%TZ)"
(OMP_NUM_THREADS=1 $CODE/.venv_kraken/bin/python -I $CODE/scripts/r5eval/score.py --preds $T/preds/q_rukopys_test --registry $REG \
--out $T/scores/q_rukopys_test --workers 2 --test-pass --gate-file $G --page-preds $T/no_page_preds --settle 0; echo "=== score rukopys_test exit $? $(date -u +%FT%TZ)") &
$CODE/.venv_vlm/bin/python -I $V/eval_vlm_test.py --short qwen3_vl_2b --model-dir $Q --registry $V/models_r5.tsv --arm qwen3_vl_2b --ckpt leader \
--evalsets $REG --preds-root $T/preds/q_synth_hand_test --sets synth_hand_test --test-pass --gate-file $G --batch 16 --deadline-utc $DL --device cuda
echo "=== synth_hand_test exit $? $(date -u +%FT%TZ)"
(OMP_NUM_THREADS=1 $CODE/.venv_kraken/bin/python -I $CODE/scripts/r5eval/score.py --preds $T/preds/q_synth_hand_test --registry $REG \
--out $T/scores/q_synth_hand_test --workers 2 --test-pass --gate-file $G --page-preds $T/no_page_preds --settle 0; echo "=== score synth_hand_test exit $? $(date -u +%FT%TZ)") &
$CODE/.venv_vlm/bin/python -I $V/eval_vlm_test.py --short qwen3_vl_2b --model-dir $Q --registry $V/models_r5.tsv --arm qwen3_vl_2b --ckpt leader \
--evalsets $REG --preds-root $T/preds/q_school_test --sets school_test --test-pass --gate-file $G --batch 16 --deadline-utc $DL --device cuda
echo "=== school_test exit $? $(date -u +%FT%TZ)"
(OMP_NUM_THREADS=1 $CODE/.venv_kraken/bin/python -I $CODE/scripts/r5eval/score.py --preds $T/preds/q_school_test --registry $REG \
--out $T/scores/q_school_test --workers 2 --test-pass --gate-file $G --page-preds $T/no_page_preds --settle 0; echo "=== score school_test exit $? $(date -u +%FT%TZ)") &
wait
echo "=== all done $(date -u +%FT%TZ)"
|