#!/bin/bash #SBATCH --job-name=lg_smoke #SBATCH --partition=ZEN4 #SBATCH --cpus-per-task=16 #SBATCH --mem=32G #SBATCH --time=03:00:00 #SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out # LOOPGUARD-1 CPU smoke (validation pages only; no held-out file is opened). Outputs: DATA/outputs/r6_loopguard/smoke/. # 0 data pins (validation; held-out pins rebuilt with the exclusion file, hashes only) # 1 om_guard.py self-test (synthetic rows, the 6,006 reference pages, the stored validation outputs re-tokenised); # lg_accept.py self-test (synthetic cases of the byte-identity tolerance rule) # 2 A0 through the changed code path, and A0 with the observe-only guard, on 3 validation pages (1 looping, 2 clean) # 3 dry run of lg_run_gpu.sh on the same pages on CPU: unguarded rerun, A1, A2, acceptance (descriptive on CPU), B flags, # om_score A1/A2/B, # selection without unseal; then a second dry run with a 30 s budget: the test-only resubmission path # 4 arm A1 first-step check on the real prompts; om_score copy with default arguments against the stored score files; # om_score --exclude-ids on validation with a dummy file of 2 gen_val ids (excl_dummy.json); held-out refusals; # smoke_check.json set -u C=/path/to/TURKIC_OCR_CODE D=/path/to/TURKIC_OCR_DATA S=$C/scripts/r5_loopguard PY=$C/.venv_vlm/bin/python PK=$C/.venv_kraken/bin/python SM=$D/outputs/r6_loopguard/smoke IDS=school_val_44,school_val_8,pg_val_mixed_uz_latn_m_000020 LOOP=school_val_44 unset HF_TOKEN HUGGING_FACE_HUB_TOKEN export HF_HOME=$D/hf_cache/r5_vlmb_home HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 TOKENIZERS_PARALLELISM=false PYTHONDONTWRITEBYTECODE=1 export OMP_NUM_THREADS=16 rm -rf $SM/page_preds $SM/dry $SM/dry2 $SM/score_repro $SM/refuse $SM/accept_selftest $SM/excl_test mkdir -p $SM hostname; date -u echo "=== 0 data pins $(date -u +%T)" $PY -I $S/lg_make_pins.py val --out $S/lg_pins_val.sha256 $PY -I $S/lg_make_pins.py heldout --out $S/lg_pins_heldout.sha256 ( cd / && sha256sum -c --quiet $S/lg_pins_val.sha256 ) && echo "val pins ok" ( cd / && sha256sum -c --quiet $S/lg_pins_heldout.sha256 ) && echo "held-out pins ok (hashes only)" echo "=== 1 self-tests $(date -u +%T)" $PY -I $S/om_guard.py --selftest --final-rule $D/outputs/r6_loopguard/design/lg_final_rule.json --out $SM/selftest.json echo "selftest rc $?" $PK -I $S/lg_accept.py --selftest $SM/accept_selftest echo "accept selftest rc $?" echo "=== 2 A0 and A0+observe $(date -u +%T)" $PY -I $S/om_eval_pages.py --model-dir $D/checkpoints/r6_onemodel/seed1/final --name smoke_A0 --arm A0 --sets gen_val,school_val \ --ids $IDS --device cpu --threads 16 --out-root $SM/page_preds echo "A0 rc $?" $PY -I $S/om_eval_pages.py --model-dir $D/checkpoints/r6_onemodel/seed1/final --name smoke_A0obs --arm A0 --observe --sets gen_val,school_val \ --ids $IDS --device cpu --threads 16 --out-root $SM/page_preds echo "A0 observe rc $?" echo "=== 3 dry run of lg_run_gpu.sh $(date -u +%T)" LG_DRY=1 LG_DEVICE=cpu LG_OUT=$SM/dry LG_X_EVAL="--ids $IDS --threads 16" LG_X_ACCEPT="--ids $IDS" bash $S/lg_run_gpu.sh echo "dry run rc $?" LG_DRY=1 LG_DEVICE=cpu LG_OUT=$SM/dry2 LG_LIMIT=30 LG_TEST_ONLY=1 LG_X_EVAL="--ids $IDS --threads 16" bash $S/lg_run_gpu.sh > $SM/dry2.log 2>&1 echo "dry run 2 (test-only resubmission) rc $?"; cat $SM/dry2.log echo "=== 4 checks $(date -u +%T)" $PY -I $S/lg_a1_first_step.py --ids $IDS --out $SM/a1_first_step.json echo "a1 first step rc $?" OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 $PK -I $S/om_score.py --name seed1_final --out $SM/score_repro > $SM/score_repro.stdout echo "om_score repro rc $?" OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 $PK -I $S/om_score.py --name seed1_final --tag excl \ --exclude-ids $SM/excl_dummy.json --out $SM/excl_test > $SM/excl_test.stdout echo "om_score exclude-ids rc $?" $PY -I $S/lg_refusal_tests.py --smoke $SM --out $SM/refusals.json echo "refusals rc $?" $PY -I $S/lg_smoke_check.py --smoke $SM --ids $IDS --loop-page $LOOP --refusals $SM/refusals.json echo "=== exit $? $(date -u)"