#!/bin/bash #SBATCH --job-name=om_dryrun #SBATCH --partition=ZEN4 #SBATCH --qos=nu-zen4 #SBATCH --gres=none #SBATCH --cpus-per-task=32 #SBATCH --mem=96G #SBATCH --time=02:00:00 #SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out # ONEMODEL pilot: CPU dry run of run_gpu.sh end to end (review M1, item 6). Tiny inputs, run name dry1, separate # output and checkpoint roots, OM_TEST_ONLY=1 so resubmission stops after 'sbatch --test-only' (nothing is ever submitted). # A from inside this allocation: sbatch --test-only scripts/r5_onemodel/onemodel_gate.sbatch seed1 (must be accepted) # B guard: run dryguard while its RUNNING file names this (running) job -> must exit 3 before any stage # C segment 1 of dry1: stage 0 (1 page per set) and its score; training with a 30 s budget -> state saved, exit 99, # resubmit() -> test-only accepted -> 'DRY RUN' exit 0 # D segment 2 of dry1: resumes the state, finishes 6 steps (exports ck_4, ck_8, ck_12 = final), spotting on 2 pages per set, # crop mode on 8 V1 + 8 clutter rows, R5 scorer, gates, clutter spotting (candidate and leader), learning curve, run_gpu.done set -uo pipefail C=/path/to/TURKIC_OCR_CODE D=/path/to/TURKIC_OCR_DATA OUT=$D/outputs/r6_onemodel/dryrun CKR=$D/checkpoints/r6_onemodel_dryrun rm -rf $OUT $CKR $D/outputs/r5/onemodel/train/dry1 $D/outputs/r5/onemodel/train/dryguard mkdir -p $OUT cd $C hostname; date -u +%FT%TZ echo "=== A test-only of the gate from inside the allocation" sbatch --test-only scripts/r5_onemodel/onemodel_gate.sbatch seed1; echo "A rc $?" sbatch --test-only --export=ALL,OM_RESUBMIT=1 scripts/r5_onemodel/onemodel_gate.sbatch seed1; echo "A2 rc $?" export OM_DEVICE=cpu OM_OUT=$OUT OM_CKPT_ROOT=$CKR OM_TEST_ONLY=1 OM_LIMIT=10800 OM_CKS="ck_4 ck_8" export OM_X_EVAL="--threads 32 --batch 2 --limit 2" OM_X_BASE="--threads 16 --limit 1" OM_X_CROP="--limit 8" TR="--smoke --threads 32 --workers 2 --page-batch 2 --crop-batch 2 --page-mb 1 --crop-mb 2 --page-samples 12 --export-at 2,4,6" echo "=== B guard refusal $(date -u +%FT%TZ)" mkdir -p $D/outputs/r5/onemodel/train/dryguard echo $SLURM_JOB_ID > $D/outputs/r5/onemodel/train/dryguard/RUNNING SLURM_JOB_ID=1 OM_LIMIT=1 OM_X_TRAIN="$TR" bash scripts/r5_onemodel/run_gpu.sh dryguard; echo "B rc $? (expected 3)" rm -rf $D/outputs/r5/onemodel/train/dryguard echo "=== C segment 1 (training budget 30 s) $(date -u +%FT%TZ)" OM_X_TRAIN="$TR --max-seconds 30" bash scripts/r5_onemodel/run_gpu.sh dry1; echo "C rc $? (expected 0 after DRY RUN)" ls -la $CKR/dry1 $CKR/dry1/state 2>&1 | head -20 ls $D/outputs/r5/onemodel/train/dry1/ 2>&1; echo "(RUNNING must be absent after the resubmission branch)" echo "=== D segment 2 (resume) $(date -u +%FT%TZ)" OM_X_TRAIN="$TR" bash scripts/r5_onemodel/run_gpu.sh dry1; echo "D rc $? (expected 0)" ls $OUT/train/dry1 $OUT/page_preds $OUT/page_scores $OUT/preds/onemodel 2>&1 ls $D/outputs/r5/onemodel/train/dry1/ 2>&1; echo "(RUNNING must be absent at the normal end)" rm -rf $D/outputs/r5/onemodel/train/dry1 echo "=== dry run done $(date -u +%FT%TZ)"