stacks/index-tts: own FastAPI wrapper for IndexTTS-2 + deploy playbook
Adds a third TTS to the irv-ml1 fleet. IndexTTS-2 is Bilibili's
emotion-controllable zero-shot TTS (paper 2506.21619). Distinguishing
capability vs the existing two: timbre and emotion are disentangled —
clone a voice's timbre from one reference and the emotion from a
different reference, OR set emotion via 8-vector, OR derive it from a
text description. Neither CosyVoice 3 nor Qwen3-TTS-1.7B-Base does
this cleanly in English.
Wrapper is owned end-to-end (~150 lines in app.py) — the only existing
FastAPI fork (csllpr/index-tts-fastapi) targets v1 and is a dormant
single-commit repo. Upstream IndexTTS-2 ships only a Gradio webui.
Layout follows the qwen3-tts pattern:
stacks/index-tts/
Dockerfile — CUDA 12.8 base, IndexTTS pinned to a SHA
app.py — FastAPI: POST /v1/audio/speech + /v1/voices
entrypoint.sh — one-time HF snapshot_download of the weights
compose.yaml — env-driven, GPU pinning support, bind mounts
.env.example — port 8192, fp16, paths
README.md — API examples + comparison vs the other TTS
playbooks/deploy-index-tts.yaml — elway playbook for irv-ml1
Voice and emotion libraries are flat host dirs of WAVs, bind-mounted.
Drop a new <name>.wav and /v1/voices picks it up immediately.
License caveat: IndexTTS-2 weights ship under a custom Bilibili
license (free at our scale, not OSI-open). README documents it.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# entrypoint.sh — fetch IndexTTS-2 weights on first run, then exec server.
|
||||
#
|
||||
# IndexTTS2() expects checkpoint files pre-staged under model_dir; if
|
||||
# they're missing, the constructor sys.exit(1)s. Pull them via
|
||||
# huggingface_hub.snapshot_download on first start. ~5-7 GB; subsequent
|
||||
# starts skip the download because config.yaml is the gate.
|
||||
|
||||
set -e
|
||||
|
||||
MODEL_DIR="${INDEX_TTS_MODEL_DIR:-/app/checkpoints}"
|
||||
mkdir -p "${MODEL_DIR}"
|
||||
|
||||
if [ ! -f "${MODEL_DIR}/config.yaml" ]; then
|
||||
echo "[index-tts] downloading IndexTTS-2 weights to ${MODEL_DIR} (~5-7 GB, one-time)"
|
||||
python3 - <<EOF
|
||||
from huggingface_hub import snapshot_download
|
||||
snapshot_download(
|
||||
repo_id="IndexTeam/IndexTTS-2",
|
||||
local_dir="${MODEL_DIR}",
|
||||
)
|
||||
EOF
|
||||
echo "[index-tts] download complete"
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user