#!/bin/bash #SBATCH --job-name=r5_gen_final #SBATCH --partition=ZEN4 #SBATCH --qos=nu-zen4 #SBATCH --gres=none #SBATCH --cpus-per-task=2 #SBATCH --mem=24G #SBATCH --time=00:40:00 #SBATCH --output=/path/to/TURKIC_OCR_DATA/logs/%x_%j.out # R5 GEN: merge the production parts into the manifests and write counts, realised statistics and production_done.json. # usage: sbatch [--dependency=...] [--begin=...] r5_finalize.sbatch PLAN_JSON STAGE # Safe to run again at any time (reads _parts, rewrites manifests; --keep-extra: no image is deleted). Stage 2 first copies the stage 1 manifests to manifests/stage1/. CODE=/path/to/TURKIC_OCR_CODE/src/pagesynth D=/path/to/TURKIC_OCR_DATA PLAN=${1:-$D/tmp/r5_plan_stage1.json} STAGE=${2:-1} M=$D/data/processed/r5/manifests mkdir -p $D/outputs/r5/gen_reports $M if [ "$STAGE" != "1" ] && [ ! -d $M/stage1 ]; then mkdir -p $M/stage1 cp $M/synth_* $M/stage1/ 2>/dev/null fi /path/to/TURKIC_OCR_CODE/.venv_gen/bin/python $CODE/scripts/r5_finalize.py --out-root $D/data/processed/r5/synth --manifest-dir $M \ --plan $PLAN --report-dir $D/outputs/r5/gen_reports --stage $STAGE --keep-extra