Skip to content

A TTS that fits in your CPU (and pocket)

Python
1.5 KB
Raw Blame

pocket-tts, the standalone binary

A port of the pocket-tts CLI (generate, serve, export-voice) that runs without Python, built on the xn-ptts implementation of the model, through a fork that adds what pocket-tts models need. The release workflow (.github/workflows/rust-release.yml) attaches its builds to every GitHub release.

cargo build --release
./target/release/pocket-tts generate --text "Hello world."

Building needs CMake and a C++ compiler, for the SentencePiece tokenizer that most community models use. x86 builds target x86-64-v3 (AVX2), see .cargo/config.toml. For a CPU without AVX2, build with RUSTFLAGS="-C target-cpu=x86-64-v2", as the -v2 archives of the releases are: --quantize is slower there (xn picks its int8 kernels at compile time), the default f32 mode is not.

Differences with the Python CLI

  • Runs on the CPU only (--device cpu), and --quantize uses xn's int8 weights.

  • serve --reload is accepted and ignored. The server answers /, /health and /tts as the Python one does, without FastAPI's /docs.

  • The noise is drawn from a different generator, so the audio differs sample by sample from the Python package's, as two runs with different seeds would. The seed is fixed, so a command always gives the same audio; POCKET_TTS_SEED sets another one.

  • The tensor operations use 4 threads by default; set RAYON_NUM_THREADS to change it.