From 0d65099704b14da0adbe37ed2f38eea8a20c8d51 Mon Sep 17 00:00:00 2001 From: xashr Date: Sat, 25 Jul 2026 21:27:26 +0000 Subject: [PATCH] refactor(docker): update docs and examples for published images, GGUF support, and Qwen3-TTS - Update Docker.md to reflect published images (ghcr.io/0xshug0/audio.cpp) instead of requiring local builds - Add table of contents and document available backends (cuda12/cuda13/cpu) and architectures (amd64/arm64) - Migrate examples to GGUF models (PocketTTS-GGUF, Qwen3-TTS-GGUF) - Add Qwen3-TTS examples with voice cloning (CLI + server) - Split server examples per model and backend (YAML, JSON, shell scripts) - Move Docker.md from repo root to docs/docker.md --- Docker.md | 70 -------------- README.md | 4 +- docs/docker.md | 91 ++++++++++++++----- examples/docker/cli/EXAMPLE.md | 65 +++++++++---- .../cli/{cpu-tts.sh => pocket-tts-cpu.sh} | 4 +- .../cli/{cuda-tts.sh => pocket-tts-cuda12.sh} | 4 +- examples/docker/cli/pocket-tts-cuda13.sh | 24 +++++ examples/docker/cli/qwen3-tts-cpu.sh | 25 +++++ examples/docker/cli/qwen3-tts-cuda12.sh | 27 ++++++ examples/docker/cli/qwen3-tts-cuda13.sh | 27 ++++++ examples/docker/models/.gitignore | 1 + examples/docker/models/put_models_here | 5 +- examples/docker/references/.gitignore | 3 + .../docker/references/put_references_here | 1 + examples/docker/server/EXAMPLE.md | 85 +++++++++++++---- .../{cpu-server.yml => pocket-tts-cpu.yml} | 7 +- ...{cuda-server.yml => pocket-tts-cuda12.yml} | 7 +- examples/docker/server/pocket-tts-cuda13.yml | 24 +++++ examples/docker/server/pocket-tts-server.json | 15 +++ .../docker/server/{tts.sh => pocket-tts.sh} | 4 +- examples/docker/server/qwen3-tts-cpu.yml | 18 ++++ examples/docker/server/qwen3-tts-cuda12.yml | 25 +++++ examples/docker/server/qwen3-tts-cuda13.yml | 25 +++++ examples/docker/server/qwen3-tts-server.json | 15 +++ examples/docker/server/qwen3-tts.sh | 17 ++++ examples/docker/server/server.json | 22 ----- 26 files changed, 439 insertions(+), 176 deletions(-) delete mode 100644 Docker.md rename examples/docker/cli/{cpu-tts.sh => pocket-tts-cpu.sh} (83%) rename examples/docker/cli/{cuda-tts.sh => pocket-tts-cuda12.sh} (83%) create mode 100755 examples/docker/cli/pocket-tts-cuda13.sh create mode 100755 examples/docker/cli/qwen3-tts-cpu.sh create mode 100755 examples/docker/cli/qwen3-tts-cuda12.sh create mode 100755 examples/docker/cli/qwen3-tts-cuda13.sh create mode 100644 examples/docker/references/.gitignore create mode 100644 examples/docker/references/put_references_here rename examples/docker/server/{cpu-server.yml => pocket-tts-cpu.yml} (72%) rename examples/docker/server/{cuda-server.yml => pocket-tts-cuda12.yml} (77%) create mode 100644 examples/docker/server/pocket-tts-cuda13.yml create mode 100644 examples/docker/server/pocket-tts-server.json rename examples/docker/server/{tts.sh => pocket-tts.sh} (68%) create mode 100644 examples/docker/server/qwen3-tts-cpu.yml create mode 100644 examples/docker/server/qwen3-tts-cuda12.yml create mode 100644 examples/docker/server/qwen3-tts-cuda13.yml create mode 100644 examples/docker/server/qwen3-tts-server.json create mode 100755 examples/docker/server/qwen3-tts.sh delete mode 100644 examples/docker/server/server.json diff --git a/Docker.md b/Docker.md deleted file mode 100644 index aba66f9d..00000000 --- a/Docker.md +++ /dev/null @@ -1,70 +0,0 @@ -# Running audio.cpp in Docker - -## Prerequisites - -- Docker must be installed and running on your system. -- For CUDA: - - The [NVIDIA container toolkit](https://github.com/NVIDIA/nvidia-container-toolkit) must be installed. - -## Images - -The following image flavors are available for this project: - -- **full**: This image provides the main tools **cli** and **server** and test binaries in one image. When running the container, the first argument selects the tool to execute. - -## Build the Image - -### CUDA - -Build with the default CUDA 12.x version. See `.devops/cuda.Dockerfile`. - -```bash -docker build -f .devops/cuda.Dockerfile -t local/audiocpp:full-cuda . -``` - -Build with a specific CUDA version, for example 13.2.0: - -```bash -docker build -f .devops/cuda.Dockerfile -t local/audiocpp:full-cuda --build-arg CUDA_VERSION=13.2.0 . -``` - -### CPU - -```bash -docker build -f .devops/cpu.Dockerfile -t local/audiocpp:full-cpu . -``` - -## Usage - -The model directory `` must be mounted into the container. -An additional `` should be mounted for TTS tasks. - -### CUDA - -```bash -docker run --rm --gpus all -v ":/models:ro" local/audiocpp:full-cuda <...> -``` - -### CPU - -```bash -docker run --rm -v ":/models:ro" local/audiocpp:full-cpu <...> -``` - -See the fully working [examples](#examples) below. - -## Examples - -Examples for Docker, including CUDA and CPU, are available in `examples/docker`. - -### PocketTTS via Docker Run - -Generate speech through the audio.cpp CLI running in Docker. - -See [EXAMPLE.md](examples/docker/cli/EXAMPLE.md) in `examples/docker/cli`. - -### PocketTTS via Docker Compose - -Generate speech through the audio.cpp server running in Docker Compose. - -See [EXAMPLE.md](examples/docker/server/EXAMPLE.md) in `examples/docker/server`. diff --git a/README.md b/README.md index 82dac9de..7728d453 100644 --- a/README.md +++ b/README.md @@ -103,8 +103,8 @@ PocketTTS language selection is a model-load option. When the model path points ## Docker -Docker CPU and CUDA images are available for both CLI and server use. See [Docker.md](Docker.md) for build commands and working Docker examples. - +Docker CUDA and CPU images are available for both CLI and server use. See [docker.md](docs/docker.md) for +available images, build commands and working Docker examples. ## Model Manager and GGUF Downloads diff --git a/docs/docker.md b/docs/docker.md index 94348ca1..39ca7572 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,68 +1,111 @@ # Running audio.cpp in Docker +## Table of Contents + +- [Prerequisites](#prerequisites) +- [Image Variants](#image-variants) +- [Published Images](#published-images) +- [Build Images locally](#build-images-locally) +- [Usage](#usage) +- [Examples](#examples) + ## Prerequisites -- Docker must be installed and running on your system +- Docker must be installed and running on your system. - For CUDA: - - The [NVIDIA container toolkit](https://github.com/NVIDIA/nvidia-container-toolkit) must be installed + - The [NVIDIA container toolkit](https://github.com/NVIDIA/nvidia-container-toolkit) must be installed. + +## Image Variants + +The following image variants are available: + +- **full**: Provides the main tools **cli** and **server** and test binaries in one image. When running the container, the first argument selects the tool to execute. + +The following backends are supported: +- **cuda12** +- **cuda13** +- **cpu** + +The following architectures are supported: +- **amd64** +- **arm64** -## Images +## Published Images -The following image flavors are available for this project: -- **full**: This image provides the main tools ***cli*** and ***server*** - and test binaries in one image. When running the container the first argument - selects the tool to execute. +Docker images are published daily when new commits are available. The images are provided +as multiarch images (amd64/arm64). -## Build the image +Pull the latest images using these tags: +- **cuda12**: `ghcr.io/0xshug0/audio.cpp:full-cuda12` +- **cuda13**: `ghcr.io/0xshug0/audio.cpp:full-cuda13` +- **cpu**: `ghcr.io/0xshug0/audio.cpp:full-cpu` + +Images for a specific day/commit can be found in the +[versions](https://github.com/0xShug0/audio.cpp/pkgs/container/audio.cpp/versions?filters%5Bversion_type%5D=tagged) +history. +The format is: `full---`, e.g. `full-cuda12-20260725-db7d2c4` + + +## Build Images locally + +If you would like to build the images locally, you can use the available +Dockerfiles in `.devops`. ### CUDA -Build with default CUDA 12.x version (see *.devops/cuda.Dockerfile*): +Build with the default CUDA 12.x version. See `.devops/cuda.Dockerfile`. ```bash -docker build -f .devops/cuda.Dockerfile -t local/audiocpp:full-cuda . +docker build -f .devops/cuda.Dockerfile -t local/audio.cpp:full-cuda12 . ``` -Build with a specific CUDA version, e.g. 13.2.0: +Build with a specific CUDA version, for example 13.3.0: + ```bash -docker build -f .devops/cuda.Dockerfile -t local/audiocpp:full-cuda --build-arg CUDA_VERSION=13.2.0 . +docker build -f .devops/cuda.Dockerfile -t local/audio.cpp:full-cuda13 --build-arg CUDA_VERSION=13.3.0 . ``` ### CPU ```bash -docker build -f .devops/cpu.Dockerfile -t local/audiocpp:full-cpu . +docker build -f .devops/cpu.Dockerfile -t local/audio.cpp:full-cpu . ``` ## Usage The model directory `` must be mounted into the container. -An additional `` should be mounted for TTS tasks. +An additional `` should be mounted for TTS tasks. ### CUDA + ```bash -docker run --rm --gpus all -v ":/models:ro" local/audiocpp:full-cuda <...> +docker run --rm --gpus all -v ":/models:ro" ghcr.io/0xshug0/audio.cpp:full-cuda12 --model /models/ <...> ``` ### CPU + ```bash -docker run --rm -v ":/models:ro" local/audiocpp:full-cpu <...> +docker run --rm -v ":/models:ro" ghcr.io/0xshug0/audio.cpp:full-cpu --model /models/ <...> ``` -See the fully working [examples](#examples) below. +See the fully working [examples](#examples) below. ## Examples -Examples for Docker (CUDA and CPU) are available in `examples/docker`. +Examples for Docker, including CUDA and CPU, are available in `examples/docker`. -### Pocket TTS via docker run +### CLI -Generate speech via audio.cpp cli running in Docker. +The **[examples](../examples/docker/cli/EXAMPLE.md)** in `examples/docker/cli` +demonstrate how to run the audio.cpp CLI with `docker run`. The examples include: -See [EXAMPLE.md](../examples/docker/cli/EXAMPLE.md) in `examples/docker/cli`. +- **PocketTTS:** Text-to-Speech +- **Qwen3-TTS:** Text-to-Speech with Voice Cloning -### Pocket TTS via Docker Compose +### Server -Generate speech via audio.cpp server running in Docker (Compose). +The **[examples](../examples/docker/server/EXAMPLE.md)** in `examples/docker/server` +demonstrate how to run the audio.cpp server with `docker compose`. The examples include: -See [EXAMPLE.md](../examples/docker/server/EXAMPLE.md) in `examples/docker/server`. +- **PocketTTS:** Text-to-Speech +- **Qwen3-TTS:** Text-to-Speech with Voice Cloning diff --git a/examples/docker/cli/EXAMPLE.md b/examples/docker/cli/EXAMPLE.md index baebad28..5230216f 100644 --- a/examples/docker/cli/EXAMPLE.md +++ b/examples/docker/cli/EXAMPLE.md @@ -2,47 +2,72 @@ Run the audio.cpp CLI tool inside a Docker container for text-to-speech. -## Setup +## PocketTTS -**1. Download the PocketTTS model** +### 1. Download the PocketTTS model -Get the English model from [kyutai/pocket-tts](https://huggingface.co/kyutai/pocket-tts/) on Hugging Face. -Place the files from `languages/english/` into `../models/pocket-tts/languages/english/`: +Get the English q8 model from +[audio-cpp/audio.cpp-gguf](https://huggingface.co/audio-cpp/audio.cpp-gguf/tree/main/PocketTTS-GGUF) +on Hugging Face. +Place the files from `english/` into `../models/PocketTTS-GGUF/english/`: The directory should look like: ``` -../models/pocket-tts/languages/english/ -├── model.safetensors -├── tokenizer.model +../models/PocketTTS-GGUF/english/ +├── pocket-tts-english-q8_0.gguf └── embeddings/ ├── alba.safetensors └── ... ``` -**2. Build the image** +### 2. Run -Run from repository root: - -CPU: +Run one of: ```bash -docker build -f .devops/cpu.Dockerfile -t local/audiocpp:full-cpu . +./pocket-tts-cuda12.sh +./pocket-tts-cuda13.sh +./pocket-tts-cpu.sh ``` -GPU (CUDA): +See the scripts for details. The scripts reference the published docker image +and save the generated speech to `output/speech.wav`. -```bash -docker build -f .devops/cuda.Dockerfile -t local/audiocpp:full-cuda . +## Qwen3-TTS (with voice cloning) + +### 1. Download the Qwen3-TTS model + +Get the Qwen3-TTS-12Hz-1.7B-Base-GGUF q8 model from +[audio-cpp/audio.cpp-gguf](https://huggingface.co/audio-cpp/audio.cpp-gguf/tree/main/Qwen3-TTS-12Hz-1.7B-Base-GGUF) +on Hugging Face. +Place the file into `../models/Qwen3-TTS-12Hz-1.7B-Base-GGUF/`: + +The directory should look like: +``` +../models/Qwen3-TTS-12Hz-1.7B-Base-GGUF/ +└── qwen3-tts-12hz-1.7b-base-q8_0_v2.gguf ``` -## Usage +### 2. Add reference audio and transcription + +Put a `ref_audio.wav` and `ref_text.txt` in `../references/`. + +The directory should look like: +``` +../references/ +├── ref_audio.wav +└── ref_text.txt +``` + +### 3. Run Run one of: ```bash -./cpu-tts.sh -./cuda-tts.sh +./qwen3-tts-cuda12.sh +./qwen3-tts-cuda13.sh +./qwen3-tts-cpu.sh ``` -Speech is saved to `output/speech.wav`. - +See the scripts for details. The scripts reference the published docker image +and save the generated speech based on the provided reference audio in `output/speech.wav`. diff --git a/examples/docker/cli/cpu-tts.sh b/examples/docker/cli/pocket-tts-cpu.sh similarity index 83% rename from examples/docker/cli/cpu-tts.sh rename to examples/docker/cli/pocket-tts-cpu.sh index 1ce266bc..47e67c81 100755 --- a/examples/docker/cli/cpu-tts.sh +++ b/examples/docker/cli/pocket-tts-cpu.sh @@ -9,11 +9,11 @@ docker run --rm \ --user "$(id -u):$(id -g)" \ -v "$MODEL_DIR:/models:ro" \ -v "$OUTPUT_DIR:/output" \ - local/audiocpp:full-cpu \ + ghcr.io/0xshug0/audio.cpp:full-cpu \ cli \ --task tts \ --family pocket_tts \ - --model /models/pocket-tts \ + --model /models/PocketTTS-GGUF/english/pocket-tts-english-q8_0.gguf \ --backend cpu \ --text "You are successfully running a text-to-speech model using audio.cpp, a pure C++ inference engine for audio models." \ --voice-id alba \ diff --git a/examples/docker/cli/cuda-tts.sh b/examples/docker/cli/pocket-tts-cuda12.sh similarity index 83% rename from examples/docker/cli/cuda-tts.sh rename to examples/docker/cli/pocket-tts-cuda12.sh index f5cd8957..6cf8ac43 100755 --- a/examples/docker/cli/cuda-tts.sh +++ b/examples/docker/cli/pocket-tts-cuda12.sh @@ -10,11 +10,11 @@ docker run --rm \ --user "$(id -u):$(id -g)" \ -v "$MODEL_DIR:/models:ro" \ -v "$OUTPUT_DIR:/output" \ - local/audiocpp:full-cuda \ + ghcr.io/0xshug0/audio.cpp:full-cuda12 \ cli \ --task tts \ --family pocket_tts \ - --model /models/pocket-tts \ + --model /models/PocketTTS-GGUF/english/pocket-tts-english-q8_0.gguf \ --backend cuda \ --device 0 \ --text "You are successfully running a text-to-speech model using audio.cpp, a pure C++ inference engine for audio models." \ diff --git a/examples/docker/cli/pocket-tts-cuda13.sh b/examples/docker/cli/pocket-tts-cuda13.sh new file mode 100755 index 00000000..fe75205a --- /dev/null +++ b/examples/docker/cli/pocket-tts-cuda13.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -e + +OUTPUT_DIR="$(cd "$(dirname "$0")" && pwd)/output" +mkdir -p "$OUTPUT_DIR" +MODEL_DIR="$(cd "$(dirname "$0")/../models" && pwd)" + +docker run --rm \ + --gpus all \ + --user "$(id -u):$(id -g)" \ + -v "$MODEL_DIR:/models:ro" \ + -v "$OUTPUT_DIR:/output" \ + ghcr.io/0xshug0/audio.cpp:full-cuda13 \ + cli \ + --task tts \ + --family pocket_tts \ + --model /models/PocketTTS-GGUF/english/pocket-tts-english-q8_0.gguf \ + --backend cuda \ + --device 0 \ + --text "You are successfully running a text-to-speech model using audio.cpp, a pure C++ inference engine for audio models." \ + --voice-id alba \ + --out /output/speech.wav + +echo "Saved to: $OUTPUT_DIR/speech.wav" diff --git a/examples/docker/cli/qwen3-tts-cpu.sh b/examples/docker/cli/qwen3-tts-cpu.sh new file mode 100755 index 00000000..290229e7 --- /dev/null +++ b/examples/docker/cli/qwen3-tts-cpu.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -e + +OUTPUT_DIR="$(cd "$(dirname "$0")" && pwd)/output" +mkdir -p "$OUTPUT_DIR" +MODEL_DIR="$(cd "$(dirname "$0")/../models" && pwd)" +REFERENCES_DIR="$(cd "$(dirname "$0")/../references" && pwd)" + +docker run --rm \ + --user "$(id -u):$(id -g)" \ + -v "$MODEL_DIR:/models:ro" \ + -v "$REFERENCES_DIR:/references:ro" \ + -v "$OUTPUT_DIR:/output" \ + ghcr.io/0xshug0/audio.cpp:full-cpu \ + cli \ + --task tts \ + --family qwen3_tts \ + --model /models/Qwen3-TTS-12Hz-1.7B-Base-GGUF/qwen3-tts-12hz-1.7b-base-q8_0_v2.gguf \ + --backend cpu \ + --text "You are successfully running a text-to-speech model using audio.cpp, a pure C++ inference engine for audio models." \ + --voice-ref /references/ref_audio.wav \ + --reference-text "$(cat "$REFERENCES_DIR/ref_text.txt")" \ + --out /output/speech.wav + +echo "Saved to: $OUTPUT_DIR/speech.wav" diff --git a/examples/docker/cli/qwen3-tts-cuda12.sh b/examples/docker/cli/qwen3-tts-cuda12.sh new file mode 100755 index 00000000..dab66ab0 --- /dev/null +++ b/examples/docker/cli/qwen3-tts-cuda12.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -e + +OUTPUT_DIR="$(cd "$(dirname "$0")" && pwd)/output" +mkdir -p "$OUTPUT_DIR" +MODEL_DIR="$(cd "$(dirname "$0")/../models" && pwd)" +REFERENCES_DIR="$(cd "$(dirname "$0")/../references" && pwd)" + +docker run --rm \ + --gpus all \ + --user "$(id -u):$(id -g)" \ + -v "$MODEL_DIR:/models:ro" \ + -v "$REFERENCES_DIR:/references:ro" \ + -v "$OUTPUT_DIR:/output" \ + ghcr.io/0xshug0/audio.cpp:full-cuda12 \ + cli \ + --task tts \ + --family qwen3_tts \ + --model /models/Qwen3-TTS-12Hz-1.7B-Base-GGUF/qwen3-tts-12hz-1.7b-base-q8_0_v2.gguf \ + --backend cuda \ + --device 0 \ + --text "You are successfully running a text-to-speech model using audio.cpp, a pure C++ inference engine for audio models." \ + --voice-ref /references/ref_audio.wav \ + --reference-text "$(cat "$REFERENCES_DIR/ref_text.txt")" \ + --out /output/speech.wav + +echo "Saved to: $OUTPUT_DIR/speech.wav" diff --git a/examples/docker/cli/qwen3-tts-cuda13.sh b/examples/docker/cli/qwen3-tts-cuda13.sh new file mode 100755 index 00000000..a58de4f4 --- /dev/null +++ b/examples/docker/cli/qwen3-tts-cuda13.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -e + +OUTPUT_DIR="$(cd "$(dirname "$0")" && pwd)/output" +mkdir -p "$OUTPUT_DIR" +MODEL_DIR="$(cd "$(dirname "$0")/../models" && pwd)" +REFERENCES_DIR="$(cd "$(dirname "$0")/../references" && pwd)" + +docker run --rm \ + --gpus all \ + --user "$(id -u):$(id -g)" \ + -v "$MODEL_DIR:/models:ro" \ + -v "$REFERENCES_DIR:/references:ro" \ + -v "$OUTPUT_DIR:/output" \ + ghcr.io/0xshug0/audio.cpp:full-cuda13 \ + cli \ + --task tts \ + --family qwen3_tts \ + --model /models/Qwen3-TTS-12Hz-1.7B-Base-GGUF/qwen3-tts-12hz-1.7b-base-q8_0_v2.gguf \ + --backend cuda \ + --device 0 \ + --text "You are successfully running a text-to-speech model using audio.cpp, a pure C++ inference engine for audio models." \ + --voice-ref /references/ref_audio.wav \ + --reference-text "$(cat "$REFERENCES_DIR/ref_text.txt")" \ + --out /output/speech.wav + +echo "Saved to: $OUTPUT_DIR/speech.wav" diff --git a/examples/docker/models/.gitignore b/examples/docker/models/.gitignore index 89042110..06f781c9 100644 --- a/examples/docker/models/.gitignore +++ b/examples/docker/models/.gitignore @@ -1,2 +1,3 @@ * !put_models_here +!.gitignore \ No newline at end of file diff --git a/examples/docker/models/put_models_here b/examples/docker/models/put_models_here index f307ddbd..e246a202 100644 --- a/examples/docker/models/put_models_here +++ b/examples/docker/models/put_models_here @@ -1,4 +1 @@ -# Download PocketTTS model files here: -# models/pocket-tts/languages/english/model.safetensors -# models/pocket-tts/languages/english/tokenizer.model -# models/pocket-tts/languages/english/embeddings/*.safetensors +# Download from https://huggingface.co/audio-cpp/audio.cpp-gguf diff --git a/examples/docker/references/.gitignore b/examples/docker/references/.gitignore new file mode 100644 index 00000000..5c26fcc7 --- /dev/null +++ b/examples/docker/references/.gitignore @@ -0,0 +1,3 @@ +* +!put_references_here +!.gitignore diff --git a/examples/docker/references/put_references_here b/examples/docker/references/put_references_here new file mode 100644 index 00000000..2fe1504c --- /dev/null +++ b/examples/docker/references/put_references_here @@ -0,0 +1 @@ +# Put reference audio and transcription here (ref_audio.wav, ref_text.txt) \ No newline at end of file diff --git a/examples/docker/server/EXAMPLE.md b/examples/docker/server/EXAMPLE.md index c6bb06a3..a76dcbe9 100644 --- a/examples/docker/server/EXAMPLE.md +++ b/examples/docker/server/EXAMPLE.md @@ -1,49 +1,98 @@ # Docker Compose Server -Run the audio.cpp TTS server (as configured in server.json) in Docker. +Run the audio.cpp TTS server as configured in the server JSON files +with Docker Compose. -## Setup +## PocketTTS -**1. Download the PocketTTS model** +### 1. Download the PocketTTS model -Get the English model from [kyutai/pocket-tts](https://huggingface.co/kyutai/pocket-tts/) on Hugging Face. -Place the files from `languages/english/` into `../models/pocket-tts/languages/english/`: +Get the English q8 model from +[audio-cpp/audio.cpp-gguf](https://huggingface.co/audio-cpp/audio.cpp-gguf/tree/main/PocketTTS-GGUF) +on Hugging Face. +Place the files from `english/` into `../models/PocketTTS-GGUF/english/`: The directory should look like: ``` -../models/pocket-tts/languages/english/ -├── model.safetensors -├── tokenizer.model +../models/PocketTTS-GGUF/english/ +├── pocket-tts-english-q8_0.gguf └── embeddings/ ├── alba.safetensors └── ... ``` -**2. Start the server** +### 2. Start the server -CPU: +Start **one** of: ```bash -docker compose -f cpu-server.yml up +docker compose -f pocket-tts-cuda12.yml up +docker compose -f pocket-tts-cuda13.yml up +docker compose -f pocket-tts-cpu.yml up ``` -GPU (CUDA): +### 3. Optionally: Wait for server to be ready ```bash -docker compose -f cuda-server.yml up +./wait-for-server.sh ``` -**3. Optionally: Wait for server to be ready** +### 4. Generate speech ```bash -./wait-for-server.sh +./pocket-tts.sh ``` -## Generate speech +This sends a request to `http://localhost:8080/v1/audio/speech` and saves +the result to `output/speech.wav`. + +## Qwen3-TTS (with voice cloning) + +### 1. Download the Qwen3-TTS model + +Get the q8 model from +[audio-cpp/audio.cpp-gguf](https://huggingface.co/audio-cpp/audio.cpp-gguf/tree/main/Qwen3-TTS-12Hz-1.7B-Base-GGUF) +on Hugging Face. +Place the file into `../models/Qwen3-TTS-12Hz-1.7B-Base-GGUF/`: + +The directory should look like: +``` +../models/Qwen3-TTS-12Hz-1.7B-Base-GGUF/ +└── qwen3-tts-12hz-1.7b-base-q8_0_v2.gguf +``` + +### 2. Add reference audio and transcription + +Put a `ref_audio.wav` and `ref_text.txt` in `../references/`. + +The directory should look like: +``` +../references/ +├── ref_audio.wav +└── ref_text.txt +``` + +### 3. Start the server + +Start **one** of: + +```bash +docker compose -f qwen3-tts-cuda12.yml up +docker compose -f qwen3-tts-cuda13.yml up +docker compose -f qwen3-tts-cpu.yml up +``` + +### 4. Optionally: Wait for server to be ready ```bash -./tts.sh +./wait-for-server.sh ``` -This sends a request to `http://localhost:8080/v1/audio/speech` and saves the result to `output/speech.wav`. +### 5. Generate speech + +```bash +./qwen3-tts.sh +``` +This sends a request to `http://localhost:8080/v1/audio/speech` with voice +cloning parameters and saves the result to `output/speech.wav`. \ No newline at end of file diff --git a/examples/docker/server/cpu-server.yml b/examples/docker/server/pocket-tts-cpu.yml similarity index 72% rename from examples/docker/server/cpu-server.yml rename to examples/docker/server/pocket-tts-cpu.yml index 9f52629d..9d4dfd1b 100644 --- a/examples/docker/server/cpu-server.yml +++ b/examples/docker/server/pocket-tts-cpu.yml @@ -1,16 +1,13 @@ services: audiocpp-server: - image: local/audiocpp:full-cpu - build: - context: ../../../ - dockerfile: .devops/cpu.Dockerfile + image: ghcr.io/0xshug0/audio.cpp:full-cpu restart: unless-stopped stop_grace_period: 30s ports: - "8080:8080" volumes: - ./../models:/models:ro - - ./server.json:/app/server.json:ro + - ./pocket-tts-server.json:/app/server.json:ro healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health"] interval: 30s diff --git a/examples/docker/server/cuda-server.yml b/examples/docker/server/pocket-tts-cuda12.yml similarity index 77% rename from examples/docker/server/cuda-server.yml rename to examples/docker/server/pocket-tts-cuda12.yml index 023ddc89..6ab0002b 100644 --- a/examples/docker/server/cuda-server.yml +++ b/examples/docker/server/pocket-tts-cuda12.yml @@ -1,9 +1,6 @@ services: audiocpp-server: - image: local/audiocpp:full-cuda - build: - context: ../../../ - dockerfile: .devops/cuda.Dockerfile + image: ghcr.io/0xshug0/audio.cpp:full-cuda12 restart: unless-stopped stop_grace_period: 30s ports: @@ -12,7 +9,7 @@ services: - NVIDIA_VISIBLE_DEVICES=all volumes: - ./../models:/models:ro - - ./server.json:/app/server.json:ro + - ./pocket-tts-server.json:/app/server.json:ro deploy: resources: reservations: diff --git a/examples/docker/server/pocket-tts-cuda13.yml b/examples/docker/server/pocket-tts-cuda13.yml new file mode 100644 index 00000000..b3ccf654 --- /dev/null +++ b/examples/docker/server/pocket-tts-cuda13.yml @@ -0,0 +1,24 @@ +services: + audiocpp-server: + image: ghcr.io/0xshug0/audio.cpp:full-cuda13 + restart: unless-stopped + stop_grace_period: 30s + ports: + - "8080:8080" + environment: + - NVIDIA_VISIBLE_DEVICES=all + volumes: + - ./../models:/models:ro + - ./pocket-tts-server.json:/app/server.json:ro + deploy: + resources: + reservations: + devices: + - capabilities: ["gpu"] + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 15s + command: ["server", "--config", "/app/server.json"] diff --git a/examples/docker/server/pocket-tts-server.json b/examples/docker/server/pocket-tts-server.json new file mode 100644 index 00000000..db7d96eb --- /dev/null +++ b/examples/docker/server/pocket-tts-server.json @@ -0,0 +1,15 @@ +{ + "host": "0.0.0.0", + "port": 8080, + "device": 0, + "threads": 1, + "models": [ + { + "id": "pocket-tts", + "family": "pocket_tts", + "path": "/models/PocketTTS-GGUF/english/pocket-tts-english-q8_0.gguf", + "task": "tts", + "mode": "offline" + } + ] +} diff --git a/examples/docker/server/tts.sh b/examples/docker/server/pocket-tts.sh similarity index 68% rename from examples/docker/server/tts.sh rename to examples/docker/server/pocket-tts.sh index 28608cdd..38af637b 100755 --- a/examples/docker/server/tts.sh +++ b/examples/docker/server/pocket-tts.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash +set -e mkdir -p output -curl http://localhost:8080/v1/audio/speech -H 'Content-Type: application/json' -o output/speech.wav -d ' +curl -f http://localhost:8080/v1/audio/speech -H 'Content-Type: application/json' -o output/speech.wav -d ' { "model": "pocket-tts", "input": "You are successfully running a text-to-speech model using audio.cpp, a pure C++ inference engine for audio models.", @@ -10,4 +11,3 @@ curl http://localhost:8080/v1/audio/speech -H 'Content-Type: application/json' - ' echo "Saved to: output/speech.wav" - diff --git a/examples/docker/server/qwen3-tts-cpu.yml b/examples/docker/server/qwen3-tts-cpu.yml new file mode 100644 index 00000000..789c34ed --- /dev/null +++ b/examples/docker/server/qwen3-tts-cpu.yml @@ -0,0 +1,18 @@ +services: + audiocpp-server: + image: ghcr.io/0xshug0/audio.cpp:full-cpu + restart: unless-stopped + stop_grace_period: 30s + ports: + - "8080:8080" + volumes: + - ./../models:/models:ro + - ./../references:/references:ro + - ./qwen3-tts-server.json:/app/server.json:ro + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 15s + command: ["server", "--config", "/app/server.json", "--backend", "cpu"] diff --git a/examples/docker/server/qwen3-tts-cuda12.yml b/examples/docker/server/qwen3-tts-cuda12.yml new file mode 100644 index 00000000..dc576b8e --- /dev/null +++ b/examples/docker/server/qwen3-tts-cuda12.yml @@ -0,0 +1,25 @@ +services: + audiocpp-server: + image: ghcr.io/0xshug0/audio.cpp:full-cuda12 + restart: unless-stopped + stop_grace_period: 30s + ports: + - "8080:8080" + environment: + - NVIDIA_VISIBLE_DEVICES=all + volumes: + - ./../models:/models:ro + - ./../references:/references:ro + - ./qwen3-tts-server.json:/app/server.json:ro + deploy: + resources: + reservations: + devices: + - capabilities: ["gpu"] + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 15s + command: ["server", "--config", "/app/server.json"] diff --git a/examples/docker/server/qwen3-tts-cuda13.yml b/examples/docker/server/qwen3-tts-cuda13.yml new file mode 100644 index 00000000..b13bfe15 --- /dev/null +++ b/examples/docker/server/qwen3-tts-cuda13.yml @@ -0,0 +1,25 @@ +services: + audiocpp-server: + image: ghcr.io/0xshug0/audio.cpp:full-cuda13 + restart: unless-stopped + stop_grace_period: 30s + ports: + - "8080:8080" + environment: + - NVIDIA_VISIBLE_DEVICES=all + volumes: + - ./../models:/models:ro + - ./../references:/references:ro + - ./qwen3-tts-server.json:/app/server.json:ro + deploy: + resources: + reservations: + devices: + - capabilities: ["gpu"] + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 15s + command: ["server", "--config", "/app/server.json"] diff --git a/examples/docker/server/qwen3-tts-server.json b/examples/docker/server/qwen3-tts-server.json new file mode 100644 index 00000000..d912bdc4 --- /dev/null +++ b/examples/docker/server/qwen3-tts-server.json @@ -0,0 +1,15 @@ +{ + "host": "0.0.0.0", + "port": 8080, + "device": 0, + "threads": 1, + "models": [ + { + "id": "qwen3-tts", + "family": "qwen3_tts", + "path": "/models/Qwen3-TTS-12Hz-1.7B-Base-GGUF/qwen3-tts-12hz-1.7b-base-q8_0_v2.gguf", + "task": "tts", + "mode": "offline" + } + ] +} diff --git a/examples/docker/server/qwen3-tts.sh b/examples/docker/server/qwen3-tts.sh new file mode 100755 index 00000000..e9c9fd41 --- /dev/null +++ b/examples/docker/server/qwen3-tts.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -e + +REFERENCES_DIR="$(cd "$(dirname "$0")/../references" && pwd)" +REF_TEXT="$(cat "$REFERENCES_DIR/ref_text.txt")" + +mkdir -p output +curl -f http://localhost:8080/v1/audio/speech -H 'Content-Type: application/json' -o output/speech.wav -d ' +{ + "model": "qwen3-tts", + "input": "You are successfully running a text-to-speech model using audio.cpp, a pure C++ inference engine for audio models.", + "voice_ref": "/references/ref_audio.wav", + "reference_text": "'"$REF_TEXT"'" +} +' + +echo "Saved to: output/speech.wav" diff --git a/examples/docker/server/server.json b/examples/docker/server/server.json deleted file mode 100644 index c772e7f3..00000000 --- a/examples/docker/server/server.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "host": "0.0.0.0", - "port": 8080, - "device": 0, - "threads": 1, - "models": [ - { - "id": "pocket-tts", - "family": "pocket_tts", - "path": "/models/pocket-tts", - "task": "tts", - "mode": "offline", - "load_options": { - "language": "english" - }, - "session_options": { - "language": "english" - } - } - ] -} -