You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stackvox's Kokoro path is kokoro-onnx on the CPU, and its speed depends heavily on the host CPU. Measured on the same 80-word paragraph, voice af_heart:
Setup
Time
Speed vs playback
ONNX, Xeon E5-2650 v2 (Ivy Bridge, no AVX2/FMA), 4 cores
36.5 s
0.66x
ONNX, Haswell i5 (AVX2/FMA), 4 threads
11.4 s
2.1x
PyTorch kokoro (same Kokoro-82M weights + voices), AMD Radeon AI PRO R9700 via ROCm 7.2
1.25 s
19.5x
So a GPU backend is roughly an order of magnitude faster, and CPU instruction support alone is a 3x difference (worth a README note on hardware expectations).
Proposal
Add a torch backend alongside the kokoro / mlx backends from #58, returning the same (samples, sample_rate). It uses the kokoro package's KModel + KPipeline, with device auto-detection (cuda covers NVIDIA and ROCm; mps on Apple Silicon).
One KModel can back several KPipelines (KPipeline(lang_code="b", model=model)), so American and British voices share a single copy of the weights.
Gotcha - AMD RDNA4 (gfx1201): MIOpen's RNN kernels fail inside Kokoro's LSTMs with miopenStatusUnknownError. torch.backends.cudnn.enabled = False avoids it - PyTorch falls back to its own GPU kernels, and the 19.5x above is with that. Probably worth applying automatically on ROCm.
Gotcha - offline use: misaki downloads spaCy's en_core_web_sm on first use if it's missing, which breaks offline/locked-down installs. Worth declaring it as a dependency of the torch extra.
VRAM: ~2 GB in practice (~0.3 GB model, the rest ROCm/PyTorch runtime).
There's a working reference in an OpenAI-compatible HTTP wrapper that uses stackvox's normalize_for_speech() + sentence splitting with PyTorch synthesis. Related: #61 (streaming).
Activity