File size: 1,454 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
#!/bin/bash
#SBATCH --job-name=j2_gpu
#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
# J2 step 6: zero-shot screen of 2-4 models on the KOHTD validation word crops, one model after another, offline.
# Order: enlargement 1x for every model of the job first, then 2x, then 3x, so that a timeout still leaves 1x for all.
# Every model writes JSONL after each batch and resumes from it: a job that ran out of time is simply submitted again.
# usage: sbatch --job-name=j2_gpuA run_gpu_job.sbatch short [short ...]
set -u
CODE=/path/to/TURKIC_OCR_CODE
DATA=/path/to/TURKIC_OCR_DATA
export HF_HUB_OFFLINE=1
unset HF_TOKEN HUGGING_FACE_HUB_TOKEN || true
OUT=$DATA/outputs/j11_stage1_kohtd
echo "job $SLURM_JOB_ID on $(hostname) models: $*"
nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv
for SCALE in 1 2 3; do
  for M in "$@"; do
    echo "=== $M scale $SCALE $(date -u +%H:%M:%S)"
    $CODE/.venv_vlm/bin/python -I $CODE/scripts/j2/run_screen.py $M $DATA/hf_cache/j2_models $CODE/scripts/j2/prompts.json \
      $OUT/screen_set_v1.tsv $DATA/data/processed/kohtd_words_raw/KOHTD_dataset/HK_dataset/img $OUT \
      --device cuda --batch-size 16 --max-new-tokens 48 --scales $SCALE 2>&1 | grep -v -E "Loading weights|^\s*$" | tail -15
  done
done
echo "[j2_gpu] done $(date -u +%H:%M:%S)"