evals-inflect / Dockerfile
bezzam's picture
bezzam HF Staff
Update Dockerfile
e9fe4c0 verified
Raw
History Blame Contribute Delete
2.02 kB
FROM nvidia/cuda:12.9.0-runtime-ubuntu24.04
# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install Python and system dependencies. git-lfs is needed to pull the model checkpoints.
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-dev \
git \
git-lfs \
libsndfile1 \
ffmpeg \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
# Set Python alias (Ubuntu 24.04 ships Python 3.12)
RUN ln -sf /usr/bin/python3 /usr/bin/python
# Allow pip to install packages system-wide in the container (PEP 668)
ENV PIP_BREAK_SYSTEM_PACKAGES=1
WORKDIR /app
# Install PyTorch (cu128 wheels for CUDA 12.8+/12.9 compat). Installed before the model's
# requirements.txt so its unpinned torch/torchaudio entries are already satisfied.
RUN pip install --no-cache-dir \
torch==2.8.0 \
torchaudio==2.8.0 \
--index-url https://download.pytorch.org/whl/cu128
# Clone the Inflect-Nano-v1 model repo (with LFS weights) and install its requirements.
# It ships the `inference` module + vendored tiny_tts frontend that run_eval.py imports.
RUN git clone https://huggingface.co/owensong/Inflect-Nano-v1 /opt/Inflect-Nano-v1 \
&& pip install --no-cache-dir -r /opt/Inflect-Nano-v1/requirements.txt
# Pre-download the NLTK data g2p_en needs (used by the text frontend), so no runtime download.
RUN python3 -c "import nltk; [nltk.download(p) for p in ('averaged_perceptron_tagger', 'averaged_perceptron_tagger_eng', 'cmudict')]"
# datasets + tqdm for the eval loop. numba (alignment kernel) and inflect (text frontend)
# are imported by the vendored tiny_tts frontend but are missing from the model's requirements.txt.
RUN pip install --no-cache-dir datasets tqdm numba inflect
# 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"]