AiPBX
Product Features Integrations
Install Mobile
Resources Docs FAQ & Tech Why PHP? Videos
Try Contact Sponsor on GitHub UpCloud ($250 Free Credit) YouTube GitHub

ONNX Runtime Local TTS (EMA Lightning, Piper, Kokoro) vs. PyTorch

Real measured CPU benchmarks replacing PyTorch (~1.1 GB runtime, ~1 GB RAM, 3.6–4.5× real time) with ONNX Runtime + numpy (~150 MB runtime, ~115–250 MB RAM, 11–12× real time on 2 cores) for EMA Lightning, Piper, and Kokoro.

Home / FAQ & Tech / ONNX Runtime Local TTS (EMA Lightning, Piper, Kokoro) vs. PyTorch
PRODUCTION · REPLACED PYTORCH

Why We Replaced PyTorch with ONNX Runtime

AiPBX 1.9.0–1.9.1 originally ran EMA Lightning on PyTorch: ~1.1 GB runtime footprint, up to 1 GB RAM, and 3.6–4.5× real-time speed on a 2-core Intel i7-7700. Porting the exact graph to ONNX Runtime + numpy shrank the runtime to ~150 MB, dropped RAM to ~115–250 MB, and tripled speed to 11–12× real time (6.4 s sentence synthesized in 0.55 s).

Measured Models & Why STT/LLM Moved to Cloud/BYO Server

Measured on 2 CPU cores: EMA Lightning (Turkish, Apache-2.0, 11–12×, ~115–250 MB), Piper (DE/EN, 13–16×, ~122–166 MB), and Kokoro 82M (English, 1.7×, ~460–650 MB shared; quantized Kokoro ONNX builds crashed ONNX Runtime so fp32 is used). We also tested local Whisper, Vosk, and Ollama, and deliberately moved STT & LLMs to Cloud AI or an external OpenAI-compatible server so CPU-only PBXs stay fast and lean.

Every downloaded ONNX model is pinned and verified by SHA-256 checksum; the ~150 MB local runtime is opt-in and never slows down standard PBX installs.
Local TTS Benchmarks Why PHP? (Architecture) All Technologies