#!/usr/bin/env bash # ============================================================================= # GSVC one-click launcher. # # Unpacks the bundled Python environment (first run only), wires up all model # caches so nothing is downloaded, and runs the acceptance harness end-to-end. # # Usage: # ./run.sh # run full acceptance over all 5 datasets # ./run.sh --clips uvg_beauty,mcl_src01 # a subset of clips # # Requirements on the host: only a CUDA-capable GPU + driver and `bash`, # `tar`. Everything else (Python, PyTorch, ffmpeg, all model weights) ships # inside this bundle. No internet access is required. # ============================================================================= set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ENV_DIR="${ROOT}/env" ENV_TARBALL="${ROOT}/gsvc_env.tar.gz" CODE_DIR="${ROOT}/code" # --------------------------------------------------------------------------- # 0. Extract the code and data archives (first run only). # --------------------------------------------------------------------------- if [ ! -d "${CODE_DIR}" ] && [ -f "${ROOT}/code.tar.gz" ]; then echo "[run] first-time setup: extracting code..." tar -xzf "${ROOT}/code.tar.gz" -C "${ROOT}" fi if [ ! -d "${ROOT}/data" ] && [ -f "${ROOT}/data.tar.gz" ]; then echo "[run] first-time setup: extracting test data..." tar -xzf "${ROOT}/data.tar.gz" -C "${ROOT}" fi # --------------------------------------------------------------------------- # 1. Unpack the relocatable conda environment (idempotent). # --------------------------------------------------------------------------- if [ ! -x "${ENV_DIR}/bin/python" ]; then echo "[run] first-time setup: unpacking Python environment (~19 GB, a few minutes)..." mkdir -p "${ENV_DIR}" tar -xzf "${ENV_TARBALL}" -C "${ENV_DIR}" # conda-unpack rewrites absolute paths baked into the env at pack time. if [ -x "${ENV_DIR}/bin/conda-unpack" ]; then "${ENV_DIR}/bin/conda-unpack" fi echo "[run] environment ready." fi PY="${ENV_DIR}/bin/python" # --------------------------------------------------------------------------- # 2. Point every cache at the bundled copies -> fully offline. # --------------------------------------------------------------------------- export HF_HOME="${ROOT}/hf_cache" export HUGGINGFACE_HUB_CACHE="${ROOT}/hf_cache/hub" export TRANSFORMERS_CACHE="${ROOT}/hf_cache/hub" export TORCH_HOME="${ROOT}/torch_cache" export HF_HUB_OFFLINE=1 export TRANSFORMERS_OFFLINE=1 export GSVC_LTX_INFER_DTYPE=bf16 export PYTORCH_ALLOC_CONF=expandable_segments:True # The gsvc code + vendored trainer are used in place (editable-style) via # PYTHONPATH, so the packed env does not need them installed. export PYTHONPATH="${CODE_DIR}/src:${CODE_DIR}/external/LTX-Video-Trainer/src:${CODE_DIR}/external/LTX-Video:${PYTHONPATH:-}" # The gsvc runtime resolves its worker interpreter as /.venv-ltx/bin/python. # Expose the unpacked env there so inference + metrics subprocesses find it. if [ ! -e "${CODE_DIR}/.venv-ltx" ]; then ln -s "${ENV_DIR}" "${CODE_DIR}/.venv-ltx" fi # --------------------------------------------------------------------------- # 3. Run the acceptance harness. # --------------------------------------------------------------------------- echo "[run] starting GSVC acceptance..." cd "${CODE_DIR}" exec "${PY}" scripts/gsvc_acceptance.py "$@"