File size: 5,520 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 57 58 59 60 61 62 | #!/bin/bash
#SBATCH --job-name=r5_vlma_tptest
#SBATCH --partition=ZEN4
#SBATCH --qos=nu-zen4
#SBATCH --gres=none
#SBATCH --cpus-per-task=4
#SBATCH --mem=48G
#SBATCH --time=01:30:00
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out
# R5 VLMA: CPU test of the test-pass mode WITHOUT test data. The registry is a scratch file in which the VALIDATION
# manifest V1 is marked locked (name LOCKEDV1) next to an unlocked entry (OPENV1); the gate file is a scratch path given
# with --gate-file (test-only argument). Models: PaddleOCR-VL-1.6 short export (VLMA) and nemotron_3_5_parse short
# export (VLMC arm through VLMB's adapter). No test manifest or test image is opened.
set -u
CODE=/path/to/TURKIC_OCR_CODE
DATA=/path/to/TURKIC_OCR_DATA
S=$CODE/scripts/r5_vlma
PY="$CODE/.venv_vlm/bin/python -I"
export HF_HUB_OFFLINE=1 TOKENIZERS_PARALLELISM=false
unset HF_TOKEN HUGGING_FACE_HUB_TOKEN || true
T=$DATA/outputs/r5/vlma/testpass_test
rm -rf $T; mkdir -p $T/preds
M=$DATA/data/processed/r5/manifests
printf '{"sets": [{"name": "LOCKEDV1", "manifest": "%s/kohtd_screen_v1.tsv", "split": "val", "locked": true, "unit": "word"}, {"name": "OPENV1", "manifest": "%s/kohtd_screen_v1.tsv", "split": "val", "locked": false, "unit": "word"}]}\n' $M $M > $T/registry.json
GATE=$T/gate_test.txt
C="--short paddleocr_vl_1_6 --arm tp_paddle --ckpt short --model-dir $DATA/checkpoints/r5/paddleocr_vl_1_6/short --registry $S/models_r5.tsv \
--evalsets $T/registry.json --preds-root $T/preds --sets LOCKEDV1,OPENV1 --device cpu --batch 3 --limit 6 --deadline-utc 2026-11-24T17:00:00Z"
echo "=== (a) no --test-pass, gate file present"; touch $GATE
$PY $S/eval_vlm_test.py $C --gate-file $GATE 2>&1 | grep -E "REFUSED|test " | cut -c1-200; echo "exit ${PIPESTATUS[0]}; files: $(ls $T/preds | wc -l)"
echo "=== (b) --test-pass, gate file absent"; rm -f $GATE
$PY $S/eval_vlm_test.py $C --test-pass --gate-file $GATE 2>&1 | grep -E "REFUSED|test " | cut -c1-200; echo "exit ${PIPESTATUS[0]}; files: $(ls $T/preds | wc -l)"
echo "=== (c) --test-pass and gate file present"; echo "gate opened for the CPU test $(date -u +%FT%TZ)" > $GATE
$PY $S/eval_vlm_test.py $C --test-pass --gate-file $GATE 2>&1 | grep -E "REFUSED|\[test|Error|Traceback" | cut -c1-250; echo "exit ${PIPESTATUS[0]}"
ls $T/preds/tp_paddle/short $T/preds/tp_paddle/short_retry; head -3 $T/preds/tp_paddle/short/LOCKEDV1.tsv
echo "=== (d) rerun: resumes (no generation)"
$PY $S/eval_vlm_test.py $C --test-pass --gate-file $GATE 2>&1 | grep -E "\[test.*LOCKEDV1" | cut -c1-200
echo "=== (e) real registry before 24 Nov 12:00 UTC: refused before the registry is opened"
$PY $S/eval_vlm_test.py --short paddleocr_vl_1_6 --arm tp_paddle_real --ckpt short --model-dir $DATA/checkpoints/r5/paddleocr_vl_1_6/short \
--registry $S/models_r5.tsv --evalsets $DATA/data/processed/r5/evalsets.json --preds-root $T/preds --sets kohtd_test --test-pass \
--gate-file $GATE --device cpu 2>&1 | grep -E "REFUSED" | cut -c1-200; echo "exit ${PIPESTATUS[0]}"
echo "=== (f) VLMB/VLMC copy (nemotron_3_5_parse): a, b, c"
VP=$CODE/.venv_vlm_nemotron_3_5_parse/bin/python
export TRANSFORMERS_OFFLINE=1 PYTHONDONTWRITEBYTECODE=1 HF_HOME=$DATA/hf_cache/r5_vlmb_home HF_MODULES_CACHE=$DATA/tmp/r5_vlmb_hf_modules/nemotron_3_5_parse
CB="--short nemotron_3_5_parse --arm tp_nemotron --ckpt short --base-dir $DATA/hf_cache/r5_vlmb_models/nemotron_3_5_parse \
--state $DATA/checkpoints/r5/nemotron_3_5_parse/short/model_bf16.pt --registry $CODE/scripts/r5_vlmb/models_r5_vlmb.tsv \
--evalsets $T/registry.json --preds-root $T/preds --sets LOCKEDV1,OPENV1 --device cpu --batch 2 --limit 4 --deadline-utc 2026-11-24T17:00:00Z"
rm -f $GATE
$VP -I $CODE/scripts/r5_vlmb/vlmb_eval_vlm_testpass.py $CB --gate-file $GATE 2>&1 | grep -E "REFUSED" | cut -c1-200; echo "(f-a) exit ${PIPESTATUS[0]}"
$VP -I $CODE/scripts/r5_vlmb/vlmb_eval_vlm_testpass.py $CB --test-pass --gate-file $GATE 2>&1 | grep -E "REFUSED" | cut -c1-200; echo "(f-b) exit ${PIPESTATUS[0]}"
echo "gate opened for the CPU test $(date -u +%FT%TZ)" > $GATE
$VP -I $CODE/scripts/r5_vlmb/vlmb_eval_vlm_testpass.py $CB --test-pass --gate-file $GATE 2>&1 | grep -E "REFUSED|LOCKEDV1|done|Error|Traceback" | cut -c1-250; echo "(f-c) exit ${PIPESTATUS[0]}"
ls $T/preds/tp_nemotron/short; head -3 $T/preds/tp_nemotron/short/LOCKEDV1.tsv
grep -E "\"complete\"|refused|LOCKEDV1|OPENV1" $T/preds/tp_nemotron/short/meta_testpass.json | head -8
echo "=== (g) runner on a task list (both kinds), gate as above"
printf '{"slot": "TEST", "deadline_utc": "2026-11-24T17:00:00Z", "not_before_utc": "2026-11-20T00:00:00Z", "evalsets": "%s", "preds_root": "%s", "gate_file": "%s", "tasks": [{"id": "tr_paddle:short", "kind": "vlma", "short": "paddleocr_vl_1_6", "arm": "tr_paddle", "ckpt": "short", "model_dir": "%s", "sets": ["LOCKEDV1"], "limit": 6, "device": "cpu", "batch": 3}, {"id": "tr_nemotron:short", "kind": "vlmb", "short": "nemotron_3_5_parse", "arm": "tr_nemotron", "ckpt": "short", "state": "%s", "sets": ["LOCKEDV1"], "limit": 4, "device": "cpu", "batch": 2}]}\n' \
$T/registry.json $T/preds $GATE $DATA/checkpoints/r5/paddleocr_vl_1_6/short $DATA/checkpoints/r5/nemotron_3_5_parse/short/model_bf16.pt > $T/tasks.json
$PY $S/testpass_runner.py $T/tasks.json 2>&1 | cut -c1-200
cat $T/testpass/state_TEST.json | grep -E "status|complete|rc"
echo "=== (g2) runner again: both tasks complete before this job"
$PY $S/testpass_runner.py $T/tasks.json 2>&1 | grep -E "done|finished" | cut -c1-160
echo "[tptest] done $(date -u +%T)"
|