Files
UmbraAudio/tts_server/install_server.sh
B.D. Murphy c86e323d7a Initial commit: UmbraAudio audiobook generation program
Quality-first multi-pass audiobook generation from English manuscripts.

Includes:
- umbraaudio/ core package (pipeline, config, voices, web review UI)
- scripts/ CLI utilities + model download script
- tts_server/ remote TTS server
- specs/ design docs, tests/, pyproject.toml + uv.lock
- Qwen3-TTS git submodule (pinned 022e286) with local demo.py UI patch
  saved at scripts/qwen3_tts_demo_umbra_patch.patch
- .env with runtime config/secrets

Excluded (see .gitignore): models/ (downloaded via scripts/download_models.sh),
output/, logs/, .venv, .umbra runtime data, and book projects
(DealHunterShip_*), which are committed separately.
2026-08-30 07:58:24 -07:00

70 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Install the UmbraAudio Qwen3-TTS server on a Linux/CUDA GPU machine.
#
# Usage:
# ./install_server.sh
#
# Assumes: python3.12 available, CUDA GPU present, ~15GB free disk for models.
#
# After install, run: ./run_server.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
PY=python3.12
if ! command -v "$PY" >/dev/null 2>&1; then
PY=python3
fi
echo "Using Python: $($PY --version)"
if [ ! -d .venv ]; then
echo ">> Creating virtualenv (.venv)"
"$PY" -m venv .venv
fi
source .venv/bin/activate
echo ">> Upgrading pip"
pip install -U pip wheel setuptools
echo ">> Detecting CUDA"
CUDA_VER=""
if nvidia-smi >/dev/null 2>&1; then
# Prefer cu12x wheels depending on available toolkit
nvcc --version 2>/dev/null | grep release || true
CUDA_VER="cu124"
fi
echo ">> Installing PyTorch (GPU)"
if [ -n "$CUDA_VER" ]; then
pip install torch torchaudio --index-url "https://download.pytorch.org/whl/$CUDA_VER"
else
echo "!! No CUDA detected. Installing CPU torch (will be slow)."
pip install torch torchaudio
fi
echo ">> Installing qwen-tts server dependencies"
pip install -r requirements.txt
echo ">> (Recommended) Installing flash-attn for faster inference + lower VRAM"
pip install -U flash-attn --no-build-isolation || \
echo "!! flash-attn build failed (ok to continue, just slower)."
MODELS_DIR="${QWEN_MODELS_DIR:-$SCRIPT_DIR/models}"
TOKENIZER_DIR="${QWEN_TOKENIZER_DIR:-$MODELS_DIR/Qwen3-TTS-Tokenizer-12Hz}"
mkdir -p "$MODELS_DIR"
echo ">> Model directories (set QWEN_MODELS_DIR to override)"
echo " Models will be stored in: $MODELS_DIR"
echo " If the 1.7B models are already on this machine, set QWEN_MODELS_DIR"
echo " to point at them; otherwise download them with:"
echo ""
echo " huggingface-cli download Qwen/Qwen3-TTS-12Hz-1.7B-Base --local-dir $MODELS_DIR/Qwen3-TTS-12Hz-1.7B-Base"
echo " huggingface-cli download Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign --local-dir $MODELS_DIR/Qwen3-TTS-12Hz-1.7B-VoiceDesign"
echo " huggingface-cli download Qwen/Qwen3-TTS-Tokenizer-12Hz --local-dir $TOKENIZER_DIR"
echo ""
echo ">> Install complete."
echo " Next: run ./run_server.sh"
echo " Health: curl http://localhost:8881/health"