turkic-ocr-code / scripts /r5_ref /ref_setup_env.sh
treoa's picture
Release 1
24aaa76
Raw History Blame Contribute Delete
1.74 kB
#!/bin/bash
# R5 REF: builds the two virtual environments of the reference arms. It only installs binary wheels (no sdist build, so no
# package build script runs); no method code runs here. Run on the login node because ZEN4 had a 7 h queue on 21 Nov 2026
# (a stated deviation from "no heavy work on the login node": the job is network and disk bound, a few CPU minutes).
# .venv_ref_tf : TensorFlow 2.15.1 (last version with Keras 2) for HTR-Flor (R1)
# .venv_ref_paddle : PaddlePaddle 3.0.0 (CUDA 12.6 build) for PaddleOCR v2.10.0 (R2)
# No credentials are in the environment.
set -u
unset HF_TOKEN HUGGING_FACE_HUB_TOKEN
C=/path/to/TURKIC_OCR_CODE
D=/path/to/TURKIC_OCR_DATA
UV=uv
mkdir -p $D/outputs/r5/ref $D/checkpoints/r5/ref $D/data/processed/r5/ref
echo "== TF venv"
$UV venv --python 3.11 $C/.venv_ref_tf
$UV pip install --only-binary :all: --python $C/.venv_ref_tf/bin/python 'tensorflow[and-cuda]==2.15.1' 'numpy<2' opencv-python-headless editdistance tqdm
$UV pip freeze --python $C/.venv_ref_tf/bin/python > $D/outputs/r5/ref/pip_freeze_ref_tf.txt
echo "== Paddle venv"
$UV venv --python 3.11 $C/.venv_ref_paddle
$UV pip install --only-binary :all: --python $C/.venv_ref_paddle/bin/python 'paddlepaddle-gpu==3.0.0' --index-url https://www.paddlepaddle.org.cn/packages/stable/cu126/ --extra-index-url https://pypi.org/simple --index-strategy unsafe-best-match
$UV pip install --only-binary :all: --python $C/.venv_ref_paddle/bin/python 'numpy<2' shapely scikit-image pyclipper lmdb tqdm rapidfuzz opencv-python-headless cython Pillow pyyaml requests albumentations albucore packaging editdistance
$UV pip freeze --python $C/.venv_ref_paddle/bin/python > $D/outputs/r5/ref/pip_freeze_ref_paddle.txt
echo "== done"