54fef0e9d8
IndexTTS-2's tts.infer(stream_return=True) is a generator that yields
audio chunks per text segment as they finish, plus inter-segment
silence. Expose this via the existing POST /v1/audio/speech with a new
"stream": true field on the request body.
Wire-up:
- 44-byte WAV header emitted up front with placeholder data length
(0xFFFFFFFF) so chunks can be written before total samples are
known. Players that read until EOF (mpv, ffplay, aplay, sox,
browsers via <audio>) handle this fine.
- Each yielded chunk goes through _chunk_to_pcm_bytes(), which
handles torch tensors / numpy arrays in either int16 or float
(-1..1) form.
- 22050 Hz mono int16 — IndexTTS-2's hardcoded output shape.
Time-to-first-audio drops from full-file latency to ~one-segment
latency. Single-sentence inputs barely benefit; long passages /
multi-paragraph reads benefit a lot. Strict metadata parsers may
balk at the placeholder size — request without stream for a
closed-length WAV in that case.
INDEX_TTS_TAG bumped to v2 to force a rebuild.
55 lines
2.7 KiB
Bash
55 lines
2.7 KiB
Bash
# IndexTTS-2 stack tunables. Copy to `.env` on irv-ml1 before deploying.
|
|
|
|
# ── build pin ────────────────────────────────────────────────────────
|
|
# SHA of index-tts/index-tts to build from. Bump + rebuild when you want
|
|
# upstream wrapper updates.
|
|
INDEX_TTS_SHA=830f6f8f94a51fea23ab1d639027a86200075a4e
|
|
|
|
# Local image tag — bump when you change build context (Dockerfile,
|
|
# app.py, entrypoint.sh) to force a fresh layer build. v2 = wrapper
|
|
# 0.2.0 with the streaming endpoint.
|
|
INDEX_TTS_TAG=v2
|
|
|
|
# ── network ──────────────────────────────────────────────────────────
|
|
# Host port. Container listens on 8000 internally.
|
|
# Reserved on irv-ml1: 8188 ComfyUI, 8190 CosyVoice, 8191 Qwen3-TTS,
|
|
# 8765 Parakeet. 8192 is open.
|
|
INDEX_TTS_PORT=8192
|
|
|
|
# Bind address. 0.0.0.0 exposes on all interfaces (incl. WG tunnel
|
|
# interface 10.100.79.3); 127.0.0.1 restricts to local-only.
|
|
INDEX_TTS_BIND=0.0.0.0
|
|
|
|
# ── runtime / GPU ────────────────────────────────────────────────────
|
|
# bf16/fp16 vs fp32. Empty = fp32. "1" = fp16. IndexTTS-2 README
|
|
# recommends fp16; ~6-10 GB VRAM at fp16, double at fp32.
|
|
INDEX_TTS_FP16=1
|
|
|
|
# GPU pinning. Empty = let IndexTTS auto-pick (cuda:0). Set to "cuda:1"
|
|
# to pin to the second GPU (irv-ml1's RTX 3090 vs RTX A6000).
|
|
INDEX_TTS_DEVICE=
|
|
|
|
# Devices visible inside the container. Either "all" (both GPUs) or a
|
|
# comma-separated list of indices (e.g. "1" to expose only the second
|
|
# card). The DEVICE setting above further restricts within those.
|
|
INDEX_TTS_GPU_DEVICES=all
|
|
|
|
# Logging level for the wrapper itself (IndexTTS internals are noisier
|
|
# regardless).
|
|
INDEX_TTS_LOG_LEVEL=INFO
|
|
|
|
# ── persistent storage on the host ───────────────────────────────────
|
|
# Model weights (~5-7 GB after first run). Bind-mounted so model state
|
|
# survives container recreate. Excluded from restic (regenerable from HF).
|
|
INDEX_TTS_CACHE_DIR=/worktank/index-tts/cache
|
|
|
|
# Voice library — flat dir of <name>.wav files (timbre references).
|
|
# Cloned voices need the original reference audio to recreate; included
|
|
# in restic.
|
|
INDEX_TTS_VOICES_DIR=/worktank/index-tts/voices
|
|
|
|
# Emotion library — flat dir of <name>.wav files (emotion references,
|
|
# typically short clips with strong affect). Optional — without any
|
|
# entries here you can still use emotion_vector or emotion_text.
|
|
INDEX_TTS_EMOTIONS_DIR=/worktank/index-tts/emotions
|