turkic-ocr-code / scripts /r5_showcase /showcase_kzb.sbatch
treoa's picture
Release 1
24aaa76
Raw History Blame Contribute Delete
2.18 kB
#!/bin/bash
#SBATCH --job-name=showcase_kzb
#SBATCH --partition=ZEN4
#SBATCH --cpus-per-task=16
#SBATCH --mem=64G
#SBATCH --time=01:00:00
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out
# Showcase job C: one page of the Kazakh Real-Document OCR Benchmark (handwritten subset; references model-drafted, corrected by hand for pages
# 0001-0030 per the dataset card) through the same page pipeline as job B. Only the chosen row of data.csv is read. SKIP picks the next page
# of the seeded order (privacy fallback).
set -u
CODE=/path/to/TURKIC_OCR_CODE
D=/path/to/TURKIC_OCR_DATA
F=$D/outputs/r5/showcase/final
O=$F/kzb
S=$CODE/scripts/r5_showcase
E=$D/outputs/r5/linedet/det_eval
echo "job $SLURM_JOB_ID host $(hostname) start $(date -u +%Y-%m-%dT%H:%M:%SZ)"
mkdir -p $O $O/tmp/yolo_cfg
unset HF_TOKEN HUGGING_FACE_HUB_TOKEN
export PYTHONDONTWRITEBYTECODE=1 HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 YOLO_OFFLINE=1 YOLO_CONFIG_DIR=$O/tmp/yolo_cfg OMP_NUM_THREADS=16 MKL_NUM_THREADS=16
$CODE/.venv_kraken/bin/python -I $S/showcase_kzb_prep.py --root $D/data/raw/kz_benchmark_hw --out $O --skip ${SKIP:-0}
echo "=== prep exit $? $(date -u +%Y-%m-%dT%H:%M:%SZ)"
$CODE/.venv_kraken/bin/python -I $S/showcase_detect.py --selection $O/selection_kzb.json --gen_pages $D/data/processed/r5_linedet_det/gen/pages_gen_val.tsv \
--school_pages $O/pages_kzb.tsv --typed_pages $F/gen/pages_typed_val.tsv \
--stored_gen $E/e2e_yolo_s2_gen_val_A1_long_pages.jsonl --stored_school $E/e2e_yolo_s2_school_val_A1_long_pages.jsonl \
--weights $D/release/rc1/turkic-line-detector-yolo11s/best.pt --out $O/pages.json --threads 16
echo "=== detect exit $? $(date -u +%Y-%m-%dT%H:%M:%SZ)"
$CODE/.venv_vlm/bin/python -I $S/showcase_read.py --pages $O/pages.json --model $D/checkpoints/r5/paddleocr_vl_1_6/leader --out $O/read.jsonl \
--crops_dir $O/crops --save_crops all --threads 16
echo "=== read exit $? $(date -u +%Y-%m-%dT%H:%M:%SZ)"
$CODE/.venv_kraken/bin/python -I $S/showcase_score.py --read $O/read.jsonl --pages $O/pages.json --b1pc $D/outputs/r5/b1_page_check \
--typed_report $F/gen/gen_report.json --out $O/scores.json
echo "=== score exit $? $(date -u +%Y-%m-%dT%H:%M:%SZ)"