Files
esh-pfi-infrastructure/stacks/index-tts/compose.yaml
T
vh b75f020cc9 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.
2026-04-25 10:38:14 -07:00

64 lines
2.5 KiB
YAML

# IndexTTS-2 — Bilibili's emotion-controllable zero-shot TTS, served
# behind our own thin FastAPI wrapper (stacks/index-tts/app.py).
#
# Why this stack exists alongside qwen3-tts and cosyvoice:
# IndexTTS-2 disentangles timbre from emotion — emotion can be cloned
# from a separate audio reference, set via 8-vector, or derived from
# free text. Neither qwen3-tts nor cosyvoice expose this cleanly in
# English. See stacks/index-tts/README.md for the full rationale.
#
# Build: image is local, built from the Dockerfile in this dir. Pinned
# upstream SHA lives in .env as INDEX_TTS_SHA so rebuilds are
# reproducible.
#
# Model: ~5-7 GB IndexTTS-2 weights download on first start via the
# entrypoint, persisted under ${INDEX_TTS_CACHE_DIR}.
#
# License note: weights carry a custom Bilibili license (free at our
# scale, but not OSI-open). The wrapper code is ours, MIT-by-default.
#
# All tunables live in .env — edit that, not this file.
services:
index-tts:
image: local/index-tts:${INDEX_TTS_TAG}
build:
context: .
dockerfile: Dockerfile
args:
INDEX_TTS_SHA: ${INDEX_TTS_SHA}
container_name: index-tts
restart: unless-stopped
runtime: nvidia
ports:
- "${INDEX_TTS_BIND:-0.0.0.0}:${INDEX_TTS_PORT}:8000"
environment:
- NVIDIA_VISIBLE_DEVICES=${INDEX_TTS_GPU_DEVICES:-all}
- INDEX_TTS_MODEL_DIR=/app/checkpoints
- INDEX_TTS_VOICES_DIR=/app/voices
- INDEX_TTS_EMOTIONS_DIR=/app/emotions
- INDEX_TTS_FP16=${INDEX_TTS_FP16:-1}
- INDEX_TTS_DEVICE=${INDEX_TTS_DEVICE:-}
- INDEX_TTS_LOG_LEVEL=${INDEX_TTS_LOG_LEVEL:-INFO}
volumes:
- ${INDEX_TTS_CACHE_DIR}:/app/checkpoints
- ${INDEX_TTS_VOICES_DIR}:/app/voices
- ${INDEX_TTS_EMOTIONS_DIR}:/app/emotions
healthcheck:
# Match Dockerfile's healthcheck. Compose-level entry overrides the
# image-level one if anything ever needs tweaking per-deploy.
test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:8000/healthz || exit 1"]
interval: 30s
timeout: 10s
retries: 3
# First boot: ~5-7 GB HF download + IndexTTS-2 import (touches several
# auxiliary HF repos for MaskGCT, campplus, BigVGAN, w2v-bert) + initial
# CUDA warmup. Generous deadline to ride that out.
start_period: 600s
labels:
- homepage.group=AI Systems
- homepage.name=IndexTTS-2
- homepage.icon=mdi-account-music
- homepage.description=Emotion-controllable TTS w/ voice cloning (irv-ml1)
- homepage.href=http://10.100.79.3:${INDEX_TTS_PORT}