mecgi/run_transcribe.sh
Davide Trentin 033b5fb21f Baseline: wiki infrastruttura MECGI, transcript, script
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 23:11:06 +02:00

31 lines
933 B
Bash
Executable file

#!/usr/bin/env bash
# Launcher: sets cuDNN/cuBLAS lib path from pip-installed nvidia wheels,
# then runs transcribe.py inside the venv.
#
# Usage:
# ./run_transcribe.sh "1 lug alle ore 08-47.m4a"
# ./run_transcribe.sh input.m4a --model large-v3 # heavier, ~5GB VRAM
# ./run_transcribe.sh input.m4a --device cpu # no GPU
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV="$HERE/.venv"
PY="$VENV/bin/python"
if [[ ! -x "$PY" ]]; then
echo "ERROR: venv python not found at $PY" >&2
exit 1
fi
# Collect every nvidia/*/lib dir shipped by the pip wheels.
NVIDIA_LIBS="$("$PY" - <<'PYEOF'
import glob, os, sys
site = next(p for p in sys.path if p.endswith("site-packages"))
dirs = glob.glob(os.path.join(site, "nvidia", "*", "lib"))
print(os.pathsep.join(dirs))
PYEOF
)"
export LD_LIBRARY_PATH="${NVIDIA_LIBS}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "$PY" "$HERE/transcribe.py" "$@"