ops: launcher fixes — uv python 3.12 pin, cu126 index (torch>=2.6), port default 8484, pip_into helper
deploy-railway / relay (push) Skipped

This commit is contained in:
pierre committed 2026-10-30 15:43:40 +03:00
1 parent bbfcdd5480
commit 15b631f33f
1 file changed
+18 -4
+18 -4
View File
@@ -12,7 +12,7 @@
set -euo pipefail
cd "$(dirname "$0")"
PORT="${CHAMBER_PORT:-8000}"
PORT="${CHAMBER_PORT:-8484}"
HOST="${CHAMBER_HOST:-127.0.0.1}"
DEVICE="auto"
@@ -31,20 +31,34 @@ PIDFILE=".chamber.pid"
have_nvidia() { command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi -L >/dev/null 2>&1; }
pip_into() {
if command -v uv >/dev/null 2>&1; then
uv pip install --quiet --python .venv/bin/python "$@"
else
.venv/bin/pip install --quiet "$@"
fi
}
install_venv() {
if [[ ! -x .venv/bin/python ]]; then
# torch has no wheels for bleeding-edge pythons; prefer uv-pinned 3.12
if command -v uv >/dev/null 2>&1; then
echo "[chamber] uv found -> venv with python 3.12"
uv venv --python 3.12 .venv
else
python3 -m venv .venv
fi
echo "[chamber] venv created"
fi
if have_nvidia && [[ "$DEVICE" != "cpu" ]]; then
echo "[chamber] NVIDIA detected -> installing CUDA torch (big download)"
.venv/bin/pip install --quiet "torch" --index-url https://download.pytorch.org/whl/cu121
pip_into "torch" --index-url https://download.pytorch.org/whl/cu126
else
echo "[chamber] CPU mode -> installing CPU torch"
.venv/bin/pip install --quiet "torch" --index-url https://download.pytorch.org/whl/cpu
pip_into "torch" --index-url https://download.pytorch.org/whl/cpu
fi
# requirements.txt pins cpu-index torch on its own line; install the rest
grep -v '^torch' live/requirements.txt | .venv/bin/pip install --quiet -r /dev/stdin
grep -v '^torch' live/requirements.txt | pip_into -r /dev/stdin
echo "[chamber] deps installed"
}