76314624bb
ci / test (push) Has been cancelled
Sub-second streaming TTS on Chatterbox-Turbo via adaptive buffer-ratchet chunking. First audio in ~0.5s (vs ~5s one-shot) with no quality compromise — chunk joins land on natural sentence pauses and the stream converges to one large near-full-context chunk within 2-3 joins. Works because the engine runs faster than realtime; the no-starvation guarantee is proven in a GPU-free simulation (tests/test_scheduler.py). - chatterbox_fast/scheduler.py: the adaptive-chunk scheduler (pure logic, no GPU) - chatterbox_fast/app.py: FastAPI server (POST /tts streaming, /voices, /health) - bench.py: streaming client (ground-truth TTFB + starvation check) - Self-contained Dockerfile (slim base + chatterbox-tts from PyPI) - Three public-domain LibriVox starter voices baked in (see voices/ATTRIBUTION.md) MIT licensed.
37 lines
1.4 KiB
Docker
37 lines
1.4 KiB
Docker
# chatterbox-fast — self-contained image. No external/private base: a slim Python
|
|
# base + the public chatterbox-tts package on PyPI, which pulls a single
|
|
# consistent torch+torchaudio (CUDA wheels) — no torchvision, so none of the
|
|
# torch/torchvision version-pinning conflicts a PyTorch base image causes.
|
|
#
|
|
# The ~6 GB Chatterbox-Turbo weights are NOT baked — they download from
|
|
# HuggingFace into HF_HOME on first run. The starter VOICES are baked (see
|
|
# voices/) so a fresh container can synthesize out of the box.
|
|
FROM python:3.11-slim
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ffmpeg libsndfile1 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV HF_HOME=/app/hf_cache \
|
|
CBF_VOICES_DIR=/app/voices \
|
|
CBF_DEFAULT_VOICE=catharine \
|
|
CBF_MODEL_DEVICE=cuda \
|
|
CBF_BIND=0.0.0.0 \
|
|
CBF_PORT=8197 \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /app
|
|
COPY pyproject.toml README.md ./
|
|
COPY chatterbox_fast ./chatterbox_fast
|
|
COPY voices ./voices
|
|
|
|
# torch is already provided by the base image; pip resolves chatterbox-tts +
|
|
# the server deps against it.
|
|
RUN pip install --no-cache-dir .
|
|
|
|
EXPOSE 8197
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=180s --retries=3 \
|
|
CMD python -c "import urllib.request,sys; b=urllib.request.urlopen('http://127.0.0.1:8197/health',timeout=5).read(); sys.exit(0 if b'\"status\":\"ok\"' in b.replace(b' ',b'') else 1)"
|
|
|
|
CMD ["chatterbox-fast"]
|