turkic-ocr-code / scripts /r5_linedet /post_chain.sbatch
treoa's picture
Release 1
24aaa76
Raw History Blame Contribute Delete
1.19 kB
#!/bin/bash
#SBATCH --job-name=r5_ld_post
#SBATCH --partition=ZEN4
#SBATCH --qos=nu-zen4
#SBATCH --gres=none
#SBATCH --cpus-per-task=16
#SBATCH --mem=48G
#SBATCH --time=04:00:00
#SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out
# After the GPU job: language-model decoding of every prediction set that the GPU job did not finish, then results.json and arch.json.
CODE=/path/to/TURKIC_OCR_CODE
DATA=/path/to/TURKIC_OCR_DATA
unset HF_TOKEN HUGGING_FACE_HUB_TOKEN
PY=$CODE/.venv_kraken/bin/python
LD=$DATA/outputs/r5/linedet
PRED=$DATA/outputs/r5/preds
export OMP_NUM_THREADS=1
if [ ! -f $LD/lm/char6.klm ] && [ -f $LD/lm/train_text_stats.json ]; then
bash $CODE/scripts/r5_linedet/lm_build.sh
fi
if [ -f $LD/lm/char6.klm ]; then
for ARM in A1 A2 A3 A4 A1s; do
for CK in short long partial; do
if [ -f $PRED/$ARM/$CK/meta.json ] && [ ! -f $PRED/$ARM/${CK}_lm/meta.json ]; then
echo "=== lm_decode $ARM $CK $(date)"
$PY -I -m linedet.lm_decode --arm $ARM --ckpt $CK --tune_set V1lm --workers 16 --max_lines 4000
fi
done
done
fi
[ -f $LD/arch.json ] || $PY -I -m linedet.arch_json
$PY -I -m linedet.collect
echo "=== post chain done $(date)"