#!/bin/bash #SBATCH --job-name=rel2_d5_yolo_s2 #SBATCH --partition=H100 #SBATCH --qos=nu-h100 #SBATCH --gres=gpu:h100:1 #SBATCH --cpus-per-task=16 #SBATCH --mem=96G #SBATCH --time=04:00:00 #SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out # RELEASE2, owner decision D5 (25 Nov 2026): retrain the stage-2 line detector WITHOUT the 83 generated train pages that carry a # personal-use font, then release it under AGPL-3.0. NOT SUBMITTED by RELEASE2; it queues after the current GPU work. # Spec: records/R5/RELEASE2/d5/d5_retrain_spec.json. Same recipe as the released stage 2 (yolo_s2, args.yaml): start from our stage-1 # weights yolo_s1c/weights/best.pt (trained on School Notebooks pages only, no generated page), image size 1280, batch 16, 200 epochs # capped by a 2.0 h time limit, seed 20261121, cosine learning rate, mosaic 0.5, rotation 2, shear 1, horizontal flip 0.3 # (CODE/src/linedet/det_yolo.py train, unchanged). Data: DATA/data/processed/r5_linedet_det/yolo_all_d5.yaml (School Notebooks # train 1,557 pages + generated train 3,916 pages; validation unchanged: 150 School Notebooks + 300 generated pages, none with a # personal-use font). Then the two detection evaluations of LINEDET on the same validation pages, for comparison with yolo_s2. # Resumable: det_yolo.py resumes from weights/last.pt if the job is cut. set -u D=/path/to/TURKIC_OCR_DATA C=/path/to/TURKIC_OCR_CODE PY=$C/.venv_kraken/bin/python export PYTHONPATH=$C/src export YOLO_OFFLINE=1 echo "start $(date -u +%FT%TZ) host $(hostname) gpu $(nvidia-smi --query-gpu=name --format=csv,noheader)" test -f $D/data/processed/r5_linedet_det/yolo_all_d5.yaml || { echo "missing yolo_all_d5.yaml"; exit 1; } test "$(ls $D/data/processed/r5_linedet_det/gen_d5/train/images | wc -l)" = "3916" || { echo "gen_d5 does not hold 3,916 pages"; exit 1; } sha256sum $D/checkpoints/r5/linedet/detectors/yolo_s1c/weights/best.pt cd $C/src $PY -m linedet.det_yolo train --data $D/data/processed/r5_linedet_det/yolo_all_d5.yaml \ --init $D/checkpoints/r5/linedet/detectors/yolo_s1c/weights/best.pt --name yolo_s2_d5 \ --epochs 200 --hours 2.0 --imgsz 1280 --batch 16 --workers 6 echo "train exit $? $(date -u +%FT%TZ)" W=$D/checkpoints/r5/linedet/detectors/yolo_s2_d5/weights/best.pt test -f $W || { echo "no best.pt"; exit 1; } sha256sum $W $PY -m linedet.det_eval --kind yolo --weights $W --pages $D/data/processed/r5_linedet_det/gen/pages_gen_val.tsv --name yolo_s2_d5_gen_val $PY -m linedet.det_eval --kind yolo --weights $W --pages $D/data/processed/r5_linedet_det/school2/pages_school_val.tsv --name yolo_s2_d5_school_val echo "end $(date -u +%FT%TZ)"