#!/bin/bash # Miniature of the line block on the KOHTD smoke data (own folders): seed 2 of A1 in two phases with a plan file, predictions with arm_label, # seed voting against the seed-1 smoke run, and one H06 run with its report. Not arm results. set -u DATA=/path/to/TURKIC_OCR_DATA LD=$DATA/outputs/r5/linedet PY=/path/to/TURKIC_OCR_CODE/.venv_kraken/bin/python SM=$DATA/data/processed/r5_linedet_smoke T=$LD/lbsmoke rm -rf $T; mkdir -p $T unset HF_TOKEN HUGGING_FACE_HUB_TOKEN export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True echo "== h06 prep"; $PY -I -m linedet.h06 prep 2>&1 | tail -2 echo "== seed 2 A1" $PY -I -m linedet.train_arm --arm A1 --mix $SM/smoke_mix.yaml --codec $LD/smoke/codec_union.json --seed 20261122 --p_short 3200 --p_long_file $LD/smoke3_plan.json --workers 3 --ckpt_dir $T/ck2 --log_dir $T/logs --log_every 50 2>&1 | grep -a -E "saved|Error|Traceback" echo "== predictions seed 2 and seed 1 (same 100 lines)" $PY -I -m linedet.predict --arm A1 --arm_label A1_s2 --ckpt long --ckpt_dir $T/ck2 --evalsets $SM/evalsets_smoke.json --limit 100 --pred_dir $T/preds --logit_dir $T/topk --workers 3 2>&1 | grep -a -E "kohtd_val_smoke|Error|Traceback" | cut -c1-200 echo "== vote" $PY -I -m linedet.seed_vote --label_a A1 --label_b A1_s2 --ckpt long --pred_dir_a $LD/smoke_gpu3/preds --logit_dir_a $LD/smoke_gpu3/topk --pred_dir_b $T/preds --logit_dir_b $T/topk --codec $LD/smoke/codec_union.json --out $T/vote.json --vote_pred_dir $T/votepreds 2>&1 | tail -3 | cut -c1-600 echo "== h06 run base10 (tiny)" $PY -I -m linedet.train_arm --arm A1 --mix $LD/h06/h06_10.yaml --codec $LD/smoke/codec_union.json --p_short 3200 --stop_after_phase1 --workers 3 --ckpt_dir $T/h06/base10 --log_dir $T/h06logs --log_every 50 2>&1 | grep -a -E "saved|Error|Traceback" | cut -c1-160 $PY -I -m linedet.predict --arm A1 --arm_label h06_base10 --ckpt short --ckpt_dir $T/h06/base10 --only V1,kohtd_val --limit 300 --pred_dir $T/h06preds --logit_dir $T/h06topk --workers 3 2>&1 | grep -a -E "V1 |kohtd_val |Error|Traceback" | cut -c1-200 echo "== h06 report" $PY -I -m linedet.h06 report 2>&1 | head -12 | cut -c1-200 echo "== done"