fix: use llm venv paths for huggingface-cli and python in download script

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tlg
2026-04-05 12:52:09 +02:00
parent 1a26d34ea5
commit 2f4d242f55

View File

@@ -1,15 +1,26 @@
#!/bin/bash #!/bin/bash
# Download all model weights for llmux. # Download all model weights for llmux.
# Run as user llm: bash scripts/download_models.sh # Run as user llm: bash scripts/download_models.sh
# Requires: pip install huggingface_hub
# Requires: HuggingFace token at ~/.cache/huggingface/token for gated models # Requires: HuggingFace token at ~/.cache/huggingface/token for gated models
set -euo pipefail set -euo pipefail
# Use llm user's venv for huggingface-cli and python
VENV="${LLMUX_VENV:-$HOME/.venv-pytorch}"
HF_CLI="${VENV}/bin/huggingface-cli"
PYTHON="${VENV}/bin/python"
if [ ! -x "$HF_CLI" ]; then
echo "ERROR: huggingface-cli not found at $HF_CLI"
echo "Install with: ${VENV}/bin/pip install huggingface_hub"
exit 1
fi
MODELS_DIR="${LLMUX_MODELS_DIR:-$HOME/.local/share/llmux_pod/models}" MODELS_DIR="${LLMUX_MODELS_DIR:-$HOME/.local/share/llmux_pod/models}"
mkdir -p "$MODELS_DIR" mkdir -p "$MODELS_DIR"
echo "=== Downloading models to $MODELS_DIR ===" echo "=== Downloading models to $MODELS_DIR ==="
echo "Using: $HF_CLI"
download_hf() { download_hf() {
local repo="$1" local repo="$1"
@@ -19,14 +30,14 @@ download_hf() {
return return
fi fi
echo "Downloading: $repo" echo "Downloading: $repo"
huggingface-cli download "$repo" --cache-dir "$MODELS_DIR" "$HF_CLI" download "$repo" --cache-dir "$MODELS_DIR"
} }
download_hf_files() { download_hf_files() {
local repo="$1" local repo="$1"
shift shift
echo "Downloading specific files from: $repo" echo "Downloading specific files from: $repo"
huggingface-cli download "$repo" "$@" --cache-dir "$MODELS_DIR" "$HF_CLI" download "$repo" "$@" --cache-dir "$MODELS_DIR"
} }
# 1. Qwen3.5-9B-FP8 # 1. Qwen3.5-9B-FP8
@@ -53,7 +64,7 @@ download_hf "CohereLabs/cohere-transcribe-03-2026" || \
# 7. Chatterbox TTS # 7. Chatterbox TTS
echo "Downloading: Chatterbox TTS weights (auto-downloaded by library)" echo "Downloading: Chatterbox TTS weights (auto-downloaded by library)"
python3 -c " "$PYTHON" -c "
from chatterbox.tts import ChatterboxTTS from chatterbox.tts import ChatterboxTTS
import os import os
os.environ['CUDA_VISIBLE_DEVICES'] = '' os.environ['CUDA_VISIBLE_DEVICES'] = ''