47 строки
1.5 KiB
Docker
47 строки
1.5 KiB
Docker
### Chatterbox Multilingual TTS Container (https://huggingface.co/ResembleAI/chatterbox) — build with ./build-container.sh [cpu|rocm]
|
|
ARG DEVICE=cpu
|
|
ARG BASE_IMAGE_CPU=python:3.12-slim
|
|
ARG BASE_IMAGE_ROCM=docker.io/rocm/pytorch-nightly
|
|
|
|
FROM ${BASE_IMAGE_CPU} AS base-cpu
|
|
FROM ${BASE_IMAGE_ROCM} AS base-rocm
|
|
|
|
FROM base-${DEVICE}
|
|
ARG DEVICE
|
|
|
|
USER root
|
|
EXPOSE 8000
|
|
|
|
# sox/ffmpeg: needed at runtime for reference-audio format handling
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends sox ffmpeg curl \
|
|
&& apt-get autoremove -y \
|
|
&& apt-get clean -y \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# CPU-only PyTorch (ROCm base image already ships its own build)
|
|
RUN if [ "$DEVICE" = "cpu" ]; then \
|
|
pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu; \
|
|
fi
|
|
|
|
RUN pip install --no-cache-dir --no-deps chatterbox-tts \
|
|
&& pip install --no-cache-dir \
|
|
numpy librosa==0.11.0 s3tokenizer transformers==5.2.0 diffusers==0.29.0 \
|
|
resemble-perth conformer==0.3.2 safetensors==0.5.3 spacy-pkuseg \
|
|
pykakasi==2.3.0 gradio==6.8.0 pyloudnorm omegaconf \
|
|
fastapi uvicorn python-multipart soundfile
|
|
|
|
# Models download at runtime here — mount as a volume to persist them
|
|
RUN mkdir -p /app/models
|
|
ENV HF_HOME=/app/models
|
|
|
|
# Copy entrypoint / server script
|
|
COPY entrypoint.sh /app/entrypoint.sh
|
|
COPY server.py /app/server.py
|
|
RUN chmod +x /app/entrypoint.sh
|
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
CMD []
|