FROM nvidia/cuda:12.9.0-runtime-ubuntu24.04 # Avoid interactive prompts during package installation ENV DEBIAN_FRONTEND=noninteractive # Install Python and system dependencies. ffmpeg/libsndfile1 for audio I/O (torchcodec/librosa). # git is handy for any source deps. RUN apt-get update && apt-get install -y --no-install-recommends \ python3 \ python3-pip \ python3-dev \ git \ libsndfile1 \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Set Python alias (Ubuntu 24.04 ships Python 3.12) RUN ln -sf /usr/bin/python3 /usr/bin/python ENV PIP_BREAK_SYSTEM_PACKAGES=1 WORKDIR /app # Install PyTorch (cu128 wheels). MOSS-TTS's [torch-runtime] extra pins torch 2.9.1 + torchcodec. RUN pip install --no-cache-dir \ torch==2.9.1 \ torchaudio==2.9.1 \ torchcodec==0.8.1 \ --index-url https://download.pytorch.org/whl/cu128 # Runtime deps for the MOSS-TTS remote code (loaded via trust_remote_code). transformers MUST # be 5.0.0 (the remote processor/generate target the 5.x API). The model + its modeling/processing # code are downloaded from the HF hub at load time into the mounted cache. RUN pip install --no-cache-dir \ "transformers==5.0.0" \ "accelerate>=1.10.1" \ safetensors==0.6.2 \ numpy==2.1.0 \ orjson==3.11.4 \ einops==0.8.1 \ scipy==1.16.2 \ librosa==0.11.0 \ tiktoken==0.12.0 \ soundfile \ datasets \ tqdm # Copy the full repository COPY . /app # Default entrypoint ENTRYPOINT ["bash"] # Keep-alive CMD so the Space runtime stays healthy; `docker run` overrides it. EXPOSE 7860 CMD ["-c", "python3 -m http.server 7860"]