Instructions to use soniqo/Kokoro-82M-LiteRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use soniqo/Kokoro-82M-LiteRT with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Kokoro 82M โ LiteRT
Kokoro-82M exported as a staged
FP32 LiteRT bundle for CPU text-to-speech. It produces 24 kHz Float32 audio
with the included af_heart voice.
This repository contains one deployment choice: the validated three-stage, 60-frame CPU/XNNPACK bundle.
Model
| Property | Value |
|---|---|
| Parameters | 82M |
| Architecture | Non-autoregressive, single pass |
| Format | LiteRT / TFLite |
| Precision | FP32 |
| Model files | 333,529,644 bytes total (318 MiB) |
| Sample rate | 24 kHz |
| Public text input | 128 token slots |
| Active text encoder/recurrent window | 32 token slots |
| Output tensor | 60 frames / 36,000 samples / 1.5 seconds |
| Runtime safety boundary | 56 frames / 33,600 samples / 1.4 seconds |
| Included voice | af_heart |
The recurrent stage preserves the accepted 128-slot result while evaluating only 32 slots. The backward-LSTM state generated by the guaranteed 96-slot zero tail is precomputed, and the remaining input projection is performed once per sequence outside compact LiteRT loops.
Longer text is supported by host-side chunking. The model-reported duration is checked after every invocation. Output above 56 frames must be discarded and retried as smaller text; the final four tensor frames are reserved as right context.
Files
| File | Bytes | SHA-256 |
|---|---|---|
kokoro-encoder.tflite |
47,877,656 | 60ac2065c78cc5ec724b3a43beb6789c084a03121018f664c561c131ce65ecaa |
kokoro-recurrent-equivalent32.tflite |
45,004,644 | 560b6318be2ac91dbeba928a634097fc6f1c30229b016f9dedacc0a6a64d2865 |
kokoro-vocoder.tflite |
240,647,344 | d8cc32713beeab8fadfb4190d5a7ada4d832ae2ecd16b82570c891f02d0e6ff6 |
config.json |
<2 KB | Runtime geometry and artifact hashes |
vocab_index.json |
2,501 | IPA symbol-to-token mapping |
us_gold.json |
3,000,469 | Primary English pronunciation dictionary |
us_silver.json |
3,099,517 | Fallback English pronunciation dictionary |
voices/af_heart.bin |
1,024 | Default 256-value Float32 voice embedding |
Validation
The complete chained bundle was compared with the FP32 PyTorch source using identical token, voice, speed, and harmonic-phase inputs.
| Check | Result |
|---|---|
| Waveform correlation | 0.999745 |
| Magnitude-spectrogram correlation | 0.999947 |
| Duration maximum absolute error | 0 |
| Duration mismatch count | 0 |
| Recurrent equivalence matrix | 0 mismatches across 42 length/speed cases |
| Validated host cutoff | 56 frames |
The physical Android and Windows wrapper outputs correlate at 0.999795 (34.4 dB SNR). The staged Android output correlates at 0.999834 with the previous accepted monolithic Android output.
Performance
Physical-device synthesis through the speech-core C++ wrapper on a Samsung
Galaxy S23 Ultra (SM-S918B, Snapdragon 8 Gen 2), Android 16, LiteRT 2.1.5,
XNNPACK, all eight CPU cores (taskset ff):
| Text | Load | Cold | Warm p50 | Warm p90 | Audio | p50 RTF | p90 RTF | Peak RSS |
|---|---|---|---|---|---|---|---|---|
Hello world. |
489.2 ms | 465.3 ms | 522.7 ms | 551.7 ms | 0.95 s | 0.550 | 0.581 | 1,017.5 MiB |
One warm-up and ten measured runs were used; model loading was excluded from RTF. Thermal status remained 0. Eight threads was faster than 4, 6, and 7 in isolated physical-device runs.
Usage with speech-core
#include <speech_core/models/litert_kokoro_tts.h>
speech_core::LiteRTKokoroTts tts(
"kokoro-encoder.tflite",
"kokoro-recurrent-equivalent32.tflite",
"kokoro-vocoder.tflite",
"voices",
".",
/*hw_accel=*/false,
/*num_threads=*/8);
tts.set_speed(1.0f);
tts.set_seed(1234);
tts.synthesize("Hello world.", "en",
[](const float* pcm, size_t samples, bool is_final) {
// 24 kHz mono Float32 PCM
});
The wrapper includes the English phonemizer, proactive token chunking, the 56-frame duration guard, retry splitting, waveform checks, and final audio assembly.
Build and run the physical benchmark:
cmake --build speech-core/build --target speech_kokoro_litert_bench
speech_kokoro_litert_bench /path/to/this/bundle \
--variant equivalent32 --threads 8 --warmup 1 --runs 10
Source
Converted from hexgrad/Kokoro-82M. The bundle uses explicit harmonic phases, compact FP32 recurrent loops, and a LiteRT-compatible iSTFT path.
- Downloads last month
- -