How do I run Kokoro TTS on a cloud GPU?

Deploy a Raw GPU instance, check the GPU with nvidia-smi and nvcc --version, install espeak-ng with apt and kokoro>=0.9.4 soundfile with pip in a Python virtual environment inside tmux, confirm that PyTorch sees your card, then create KPipeline(lang_code='a', repo_id='hexgrad/Kokoro-82M', device='cuda') in a short Python script, write each generated chunk to a 24 kHz .wav file, and copy the files off before you destroy the instance.
Updated 2026-10-31
This guide follows the kokoro README, its kokoro/pipeline.py source, the Kokoro-82M model card with its VOICES.md, and the kokoro package page on PyPI, all read on 2026-10-31. The latest kokoro release on PyPI that day was 0.9.4 (uploaded 2025-04-05). It is for audiobook, video and app creators who want to turn a lot of text into speech on a rented NVIDIA GPU such as the RTX 5090 or the other cards listed on /pricing.
Kokoro-82M is an 82-million-parameter text-to-speech model. The model card and the kokoro code repository both state the Apache-2.0 license, and the Hugging Face repository hexgrad/Kokoro-82M is not gated. The model card also lists two CC BY audio datasets that were part of the v1.0 training data; read that section if you need to credit sources in your own project.
What you need
| Item | Official value (read 2026-10-31) | Source |
|---|---|---|
| Install | pip install -q kokoro>=0.9.4 soundfile and apt-get -qq -y install espeak-ng |
kokoro README |
| Python | >=3.10, <3.13 |
PyPI metadata for kokoro 0.9.4 |
| PyTorch | torch with no version pin |
PyPI metadata for kokoro 0.9.4 (requires_dist) |
| Model | Kokoro-82M v1.0 (published 2025 Jan 27), 8 languages and 54 voices | model card release table |
| Hugging Face model ID | hexgrad/Kokoro-82M (default repo_id; not gated) |
kokoro/pipeline.py, Hugging Face model API |
| Output | 24,000 Hz audio, one array per text chunk | README example (sf.write(..., audio, 24000)) |
The parameter count is the project’s own figure, not a CloudGPU measurement. VRAM need depends on model, precision and workflow; see How much VRAM do I need to run an LLM? for the general method, and the VRAM of each card in the Performance table on /pricing (CloudGPU’s own listing).
Step 1: Deploy a Raw GPU and connect
On /deploy, pick an NVIDIA GPU and the Raw GPU option (JupyterLab + CUDA pre-installed, root SSH on a dedicated container). Connect over SSH with the host, port and user shown for your instance, or open a terminal in JupyterLab.
Step 2: Check the GPU and tools
nvidia-smi # GPU name, driver version and the "CUDA Version" the driver supports
nvcc --version # CUDA toolkit version, if installed
python3 --version # kokoro 0.9.4 needs 3.10, 3.11 or 3.12
which git tmux rsync espeak-ng
If python3 --version shows 3.13 or newer, create the virtual environment with a 3.10–3.12 interpreter instead (for example apt-get install -y python3.12-venv if your image offers it). Install what is missing with apt (you are root on the container):
apt-get update && apt-get install -y tmux rsync espeak-ng
The README uses espeak-ng for English out-of-dictionary words and for some non-English languages.
Step 3: Install kokoro
Install into a virtual environment, inside tmux so the install keeps going if SSH disconnects:
tmux new -s tts
python3 -m venv ~/kokoro-env
source ~/kokoro-env/bin/activate
pip install -U pip
pip install "kokoro>=0.9.4" soundfile
Because kokoro does not pin torch, pip installs whatever PyTorch build it resolves that day. Check that the build sees your GPU before you go further:
python -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available()); print(torch.cuda.get_device_name(0)); print(torch.cuda.get_arch_list())"
On an RTX 5090, look for sm_120 in the last line. If it is missing, or is_available() prints False, install a PyTorch build that matches your driver; see How to install a specific PyTorch CUDA version on a cloud GPU.
Step 4: Generate speech on the GPU
Save this as ~/tts/kokoro_run.py. It follows the README’s advanced example, with the device and repository set explicitly (both are parameters of KPipeline in kokoro/pipeline.py):
from pathlib import Path
import soundfile as sf
from kokoro import KPipeline
out = Path.home() / "tts" / "out"
out.mkdir(parents=True, exist_ok=True)
# 'a' = American English, 'b' = British English (see VOICES.md for the others)
pipeline = KPipeline(lang_code="a", repo_id="hexgrad/Kokoro-82M", device="cuda")
text = Path.home().joinpath("tts", "input.txt").read_text(encoding="utf-8")
# split_pattern=r"\n+" makes each paragraph its own chunk
for i, (graphemes, phonemes, audio) in enumerate(
pipeline(text, voice="af_heart", speed=1, split_pattern=r"\n+")
):
sf.write(out / f"{i:04d}.wav", audio, 24000)
print(i, graphemes[:60])
Put your text in ~/tts/input.txt (one paragraph per line) and run it:
mkdir -p ~/tts && cd ~/tts
python kokoro_run.py
The first run downloads the model and the chosen voice from Hugging Face. With device="cuda", pipeline.py raises an error if PyTorch cannot use CUDA instead of falling back to the CPU, so a failure here points back to the Step 3 check.
Step 5: Pick a language and voice
VOICES.md on the model card lists each voice with its lang_code. Keep the two matched: the README’s comment on KPipeline says to make sure lang_code matches the voice. According to the README, Japanese needs pip install misaki[ja] and Mandarin needs pip install misaki[zh] before you use those lang_code values; the other languages use misaki[en], which kokoro installs.
To join the chunks into one file, read them back in order and concatenate:
import numpy as np, soundfile as sf
from pathlib import Path
parts = sorted((Path.home() / "tts" / "out").glob("*.wav"))
sf.write(Path.home() / "tts" / "full.wav", np.concatenate([sf.read(p)[0] for p in parts]), 24000)
Check your own setup
These are checks to do on your own instance; this page does not assume the result.
- PyTorch sees the GPU: the Step 3 check prints
Trueand your GPU name (andsm_120on an RTX 5090). - Kokoro uses the GPU: while
kokoro_run.pyruns,nvidia-smiin a second SSH session lists apythonprocess on the GPU. See How to check GPU utilization on a cloud GPU. - The audio is what you expect: copy one
.wavfile to your computer and listen to it before you queue a long job.
If generation runs out of GPU memory
Our own measurements on CloudGPU are coming; until then, verify with the nvidia-smi checks below.
While your script runs, check GPU memory from a second SSH session:
nvidia-smi --query-gpu=name,memory.used,memory.total --format=csv
nvidia-smi # the process list at the bottom shows each process and the GPU memory it uses
If you hit a CUDA out-of-memory error, close other processes on the GPU (check nvidia-smi), split long paragraphs into shorter lines so each chunk is smaller, or deploy a card with more VRAM from /pricing.
Before you destroy the instance
According to /terms, data on an instance is permanently deleted when the instance is destroyed. Copy your audio to your computer first:
rsync -avP -e "ssh -p <ssh-port>" <ssh-user>@<ssh-host>:tts/ ./tts-output/
GPU time is billed per minute, rounded up, with a 1-minute minimum, and billing stops when you destroy the instance; see /terms.
Related guides
- How to run Chatterbox TTS on a cloud GPU
- How to transcribe audio with WhisperX on a cloud GPU
- How to install a specific PyTorch CUDA version on a cloud GPU
- How does per-minute GPU billing work?
FAQ
What Python version does Kokoro TTS need? The kokoro 0.9.4 package on PyPI requires Python 3.10 or newer and below 3.13. Run python3 --version before you create the virtual environment, and use a 3.10 to 3.12 interpreter if your system Python is newer.
Does Kokoro TTS work on an RTX 5090? Check before you rely on it. kokoro does not pin a PyTorch version, so the result depends on the PyTorch build pip installs. Run torch.cuda.get_arch_list() after installing and look for sm_120; if it is missing, install a PyTorch build that supports your driver.
How do I make Kokoro use the GPU? Pass device=“cuda” when you create KPipeline. If you leave device unset, kokoro picks CUDA whenever PyTorch can use it. With device=“cuda” set, it raises an error instead of falling back to the CPU.
Which voices and languages does Kokoro-82M support? The model card lists 8 languages and 54 voices for v1.0. VOICES.md gives each voice with its lang_code, and the README says the lang_code must match the voice. Japanese and Mandarin need the misaki[ja] or misaki[zh] extra.
Will my audio files stay on the instance after I destroy it? No. Data on an instance is permanently deleted when the instance is destroyed, so copy your output folder to your computer first. Billing is per minute, rounded up, with a 1-minute minimum, and stops when you destroy the instance.
Sources
- kokoro README and
kokoro/pipeline.py(KPipelinerepo_idanddeviceparameters): https://github.com/hexgrad/kokoro (read 2026-10-31; license Apache-2.0) - kokoro on PyPI (version 0.9.4, uploaded 2025-04-05; Python
>=3.10,<3.13; unpinnedtorch): https://pypi.org/project/kokoro/ (read 2026-10-31) - Kokoro-82M model card and VOICES.md (Apache-2.0, not gated; v1.0 release table; CC BY training-data section): https://huggingface.co/hexgrad/Kokoro-82M (read 2026-10-31)
- CloudGPU /pricing, /deploy, /terms (read 2026-10-31)