Skip to content

Open-source State-of-the-art TTS model which runs on a CPU 😻

Python

Add Docker support for the GPU backends

haaziq-sla6838e363ef3
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..431ebfb
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,17 @@
+FROM python:3.12-slim-bookworm
+
+ENV PYTHONUNBUFFERED=1 \
+ HF_HOME=/cache/huggingface \
+ VLLM_CACHE_ROOT=/cache/vllm
+
+# Triton compiles small GPU kernels at runtime and needs a C compiler.
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends build-essential \
+ && rm -rf /var/lib/apt/lists/*
+
+WORKDIR /opt/kittenml
+COPY pyproject.toml README.md ./
+COPY kittenml ./kittenml
+RUN pip install --no-cache-dir ".[vllm]"
+
+WORKDIR /workspace
diff --git a/README.md b/README.md
index 6453233..a9cfc5a 100644
--- a/README.md
+++ b/README.md
@@ -253,6 +253,7 @@ Two consequences worth knowing:
| [Decoders](docs/decoders.md) | How audio is decoded, and the smaller quantised decoders |
| [Text normalization](docs/text-normalization.md) | How written text becomes spoken text |
| [Architecture](docs/architecture.md) | What the model is, package layout, vendored components |
+| [Docker](docs/docker.md) | Run the vLLM or PyTorch GPU backend in a container |
| [Lightweight ONNX models](docs/onnx-models.md) | The CPU models, 15M-80M parameters, and their API |
## System Requirements
diff --git a/docs/README.md b/docs/README.md
index 33d92ff..86473e7 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -8,6 +8,7 @@ Fuller detail than the [project README](../README.md), which covers getting star
| [voices-and-expression.md](voices-and-expression.md) | The 47 built-in voices, the emotion and vocal-event tags, the ten languages |
| [decoders.md](decoders.md) | How audio is decoded, and the smaller quantised decoders |
| [vllm.md](vllm.md) | Optional NVIDIA GPU inference with vLLM |
+| [docker.md](docker.md) | Running the vLLM or PyTorch GPU backend in a container |
| [text-normalization.md](text-normalization.md) | How written text becomes spoken text |
| [architecture.md](architecture.md) | What the model is, package layout, vendored components |
| [onnx-models.md](onnx-models.md) | The lightweight CPU models and their API |
diff --git a/docs/docker.md b/docs/docker.md
new file mode 100644
index 0000000..2e66131
--- /dev/null
+++ b/docs/docker.md
@@ -0,0 +1,27 @@
+# Running with Docker
+
+Use a Linux host with Docker, an NVIDIA GPU and the
+[NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).
+The host driver must meet the [vLLM GPU requirements](https://docs.vllm.ai/en/v0.31.0/getting_started/installation/gpu/).
+
+From the repository root, build the image:
+
+```sh
+docker build -t kittenml .
+```
+
+Save the [README's vLLM example](../README.md#running-with-vllm) as
+`vllm_example.py`, then run it:
+
+```sh
+docker run --rm --gpus all --ipc=host \
+ -v kittenml-cache:/cache -v "$PWD:/workspace" \
+ kittenml python vllm_example.py
+```
+
+The command saves `output.wav` in the current directory. The named volume keeps
+model downloads and compilation caches between runs. Model files are downloaded
+on first use and are not included in the image.
+
+The image also includes the existing PyTorch backend. Run your own Python script
+by replacing `vllm_example.py` in the command above.