File size: 2,545 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
#SBATCH --job-name=rc1_smoke
#SBATCH --partition=ZEN4
#SBATCH --cpus-per-task=16
#SBATCH --mem=64G
#SBATCH --time=00:40:00
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out
# Release candidate 1, smoke test of the five infer.py files on 4 validation word crops and one validation page, plus the detector's
# checkpoint metadata and parameter count. Outputs go to DATA/tmp/rc1_smoke, never into a package folder. Validation data only.
set -u
CODE=/path/to/TURKIC_OCR_CODE
D=/path/to/TURKIC_OCR_DATA
R=$D/release/rc1
W=$D/tmp/rc1_smoke
SC=$CODE/scripts/r5_release
PV=$CODE/.venv_vlm/bin/python
PK=$CODE/.venv_kraken/bin/python
unset HF_TOKEN HUGGING_FACE_HUB_TOKEN
export PYTHONDONTWRITEBYTECODE=1 HF_HOME=$W/hf_home HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 YOLO_OFFLINE=1 YOLO_CONFIG_DIR=$W/yolo_cfg OMP_NUM_THREADS=16
echo "job $SLURM_JOB_ID host $(hostname) start $(date -u +%Y-%m-%dT%H:%M:%SZ)"
mkdir -p $W/run
cd $W/run
head -n 5 $D/data/processed/r5/manifests/kohtd_screen_v1.tsv > $W/v1_4.tsv
printf 'id\timage\n' > $W/page1.tsv
grep -o -P '^pg_val_diagram_az_l_000008\t[^\t]*' $D/data/processed/r5_linedet_det/gen/pages_gen_val.tsv >> $W/page1.tsv
cat $W/page1.tsv

echo "== detector metadata"
$PK -I $SC/rc1_prep_det.py $R/turkic-line-detector-yolo11s/best.pt $W/prep_det.json
echo "exit $?"

echo "== A1 greedy"
$PK -B -I $R/turkic-ocr-ppocrv6-medium/infer.py --manifest $W/v1_4.tsv --out $W/a1_greedy.tsv --device cpu --threads 16 --with-conf
echo "exit $?"
cat $W/a1_greedy.tsv
echo "== A1 lm_gated"
$PK -B -I $R/turkic-ocr-ppocrv6-medium/infer.py --manifest $W/v1_4.tsv --out $W/a1_gated.tsv --decode lm_gated --device cpu --threads 16 --with-conf
echo "exit $?"
cat $W/a1_gated.tsv

echo "== paddle"
$PV -B -I $R/turkic-ocr-paddleocr-vl-1.6/infer.py --manifest $W/v1_4.tsv --out $W/paddle.tsv --unit word --device cpu --threads 16 --with-conf
echo "exit $?"
cat $W/paddle.tsv
echo "== qwen"
$PV -B -I $R/turkic-ocr-qwen3-vl-2b/infer.py --manifest $W/v1_4.tsv --out $W/qwen.tsv --unit word --device cpu --threads 16 --with-conf
echo "exit $?"
cat $W/qwen.tsv

echo "== detector"
$PK -B -I $R/turkic-line-detector-yolo11s/infer.py --manifest $W/page1.tsv --out $W/det.tsv --device cpu
echo "exit $?"
head -c 600 $W/det.tsv

echo "== page pipeline"
$PV -B -I $R/page-pipeline/infer.py --manifest $W/page1.tsv --out $W/page_pages.tsv --lines-out $W/page_lines.tsv --detector-python $PK --device cpu --threads 16
echo "exit $?"
cat $W/page_pages.tsv
head -n 5 $W/page_lines.tsv
echo "end $(date -u +%Y-%m-%dT%H:%M:%SZ)"