File size: 3,434 Bytes
7718ac6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/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 <code>/.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 "$@"