tiny-voca-da / recipe /docker /Dockerfile
inlanger's picture
tiny-voca-da v0.1: frontend v4 + sm9 vocoder (ONNX fp32/int8, PyTorch, frontend, recipe, samples)
adabee1 verified
Raw History Blame Contribute Delete
3.01 kB
# tiny-voca Danish kit, CUDA 12.8 build (mirrors kit/setup.sh with MODE=cuda).
# PyTorch cu128 wheels ship their own CUDA runtime; the NVIDIA container runtime
# injects the driver, so a plain Ubuntu base is enough. Python 3.12 is Ubuntu 24.04's default.
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONUNBUFFERED=1
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates git build-essential pkg-config unzip \
python3.12 python3.12-venv python3.12-dev \
libseccomp2 libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
ARG BASE_COMMIT=3af29adc2b9dc0a0441fb1d8bb3507e1a7e0fc05
# kit = v2 frontend (eSpeak); kit-v3 = v3 frontend (NST lexicon with stød). Same base commit.
ARG KIT=kit
WORKDIR /opt/kit
# 1. Pinned tiny-voca-it + Danish patch.
COPY ${KIT}/patches/ patches/
RUN git init -q tiny-voca \
&& git -C tiny-voca remote add origin https://github.com/carbogninalberto/tiny-voca-it.git \
&& git -C tiny-voca fetch -q --depth 1 origin "$BASE_COMMIT" \
&& git -C tiny-voca checkout -q --detach FETCH_HEAD \
&& test "$(git -C tiny-voca rev-parse HEAD)" = "$BASE_COMMIT" \
&& git -C tiny-voca apply --check /opt/kit/patches/danish.patch \
&& git -C tiny-voca apply /opt/kit/patches/danish.patch
# 2. Python env: torch 2.8.0 cu128 (has sm_120 kernels for RTX 50xx), then the lock file.
RUN python3.12 -m venv .venv \
&& .venv/bin/python -m pip install -q 'pip==25.3' \
&& .venv/bin/python -m pip install torch==2.8.0 torchaudio==2.8.0 \
--index-url https://download.pytorch.org/whl/cu128
COPY ${KIT}/requirements.lock.txt ${KIT}/prepare_coral_requirements.txt ./
RUN .venv/bin/python -m pip install -r requirements.lock.txt \
&& .venv/bin/python -m pip install --no-deps -e ./tiny-voca
# 3. eSpeak NG 1.52.0 at the pinned commit (GPL-3.0, built as a separate program).
COPY ${KIT}/install_espeak.sh ./
RUN PATH=/opt/kit/.venv/bin:$PATH bash install_espeak.sh \
&& rm -rf .tools/espeak-src .tools/espeak-build
# 3b. Pretrained Vocos (MIT) as the distillation teacher for tiny_voca.train_vocoder.
# --no-deps keeps the pinned torch/torchaudio/numpy from requirements.lock.txt.
RUN .venv/bin/python -m pip install --no-deps vocos==0.1.0 encodec==0.1.1 einops==0.8.1
# 4. The rest of the kit (scripts, config, aligner head, probes, tests).
COPY ${KIT}/ ./
ENV TINY_VOCA_KIT_ROOT=/opt/kit \
VIRTUAL_ENV=/opt/kit/.venv \
PATH=/opt/kit/.tools/espeak/bin:/opt/kit/.venv/bin:$PATH \
ESPEAK_DATA_PATH=/opt/kit/.tools/espeak/share/espeak-ng-data \
TINY_VOCA_FRONTEND=espeak \
HF_HOME=/opt/kit/cache/hf \
HOME=/tmp
# Build-time checks: the shipped config must equal the generated one, and the
# frontend/model must load (CPU only here; CUDA is checked at runtime).
RUN python make_config.py --output config.da.json \
&& python check_environment.py --device cpu > /opt/kit/build_environment.json \
&& chmod -R a+rX /opt/kit
CMD ["bash"]