Views
No views yet
| Property | Value |
|---|---|
| Parameters | 82M |
| Architecture | Non-autoregressive, single-pass |
| Format | ONNX (opset 18) |
| Weights | 155 MB (FP16 storage → FP32 compute, shared external data) |
| Sample rate | 24 kHz |
| Max phonemes | 128 |
| Max audio | 5s (120,000 samples) |
| Voices | 50+ (256-dim embeddings) |
| Languages | 8 (en, fr, es, ja, zh, ko, hi, pt) |
| Graph | Audio tensor | Intended use |
|---|---|---|
kokoro-e2e.onnx | [1, 1, 120000] (5.0 s) | Full-capacity synthesis |
kokoro-e2e-realtime.onnx | [1, 1, 72000] (3.0 s) | Default short voice-agent replies |
kokoro-e2e-realtime.onnx references the same kokoro-e2e.onnx.data file as the full graph. It avoids decoder work over the unused padded tail on short replies. For text that would exceed its safe output window, split at sentence or word boundaries and synthesize the pieces; speech-core performs that retry automatically.| File | Size | Description |
|---|---|---|
kokoro-e2e.onnx | 3.5 MB | Full-capacity model graph |
kokoro-e2e-realtime.onnx | 2.9 MB | 3.0 s short-turn graph; shares the weights file below |
kokoro-e2e.onnx.data | 155 MB | Model weights (external data, FP16 storage) |
vocab_index.json | 2 KB | IPA phoneme → token ID mapping |
us_gold.json | 1.5 MB | Primary pronunciation dictionary |
us_silver.json | 3.2 MB | Fallback pronunciation dictionary |
voices/*.bin | 1 KB each | Voice embeddings (256 × float32) |
| Name | Shape | Type | Description |
|---|---|---|---|
input_ids | [1, 128] | int64 | Phoneme token IDs (zero-padded) |
attention_mask | [1, 128] | int64 | 1 for real tokens, 0 for padding |
ref_s | [1, 256] | float32 | Voice style embedding |
speed | [1] | float32 | Speed factor (1.0 = normal) |
random_phases | [1, 9] | float32 | Initial harmonic phases (uniform [0,1)) |
kokoro-e2e.onnx)| Name | Shape | Type | Description |
|---|---|---|---|
audio | [1, 1, 120000] | float32 | Raw PCM waveform (24 kHz) |
audio_length_samples | [1] | int64 | Valid sample count (trim audio to this) |
pred_dur | [1, 128] | float32 | Predicted phoneme durations |
kokoro-e2e-realtime.onnx, the audio output is [1, 1, 72000]; the other input and output tensors are unchanged.1import numpy as np
2import onnxruntime as ort
3
4sess = ort.InferenceSession("kokoro-e2e.onnx")
5
6# Prepare inputs (phoneme IDs from vocab_index.json)
7input_ids = np.zeros((1, 128), dtype=np.int64)
8input_ids[0, :5] = [0, 60, 46, 79, 0] # example phonemes
9attention_mask = np.zeros((1, 128), dtype=np.int64)
10attention_mask[0, :5] = 1
11
12# Load voice embedding (256 floats from .bin file)
13voice = np.fromfile("voices/af_heart.bin", dtype=np.float32).reshape(1, 256)
14
15output = sess.run(None, {
16 "input_ids": input_ids,
17 "attention_mask": attention_mask,
18 "ref_s": voice,
19 "speed": np.ones(1, dtype=np.float32),
20 "random_phases": np.random.rand(1, 9).astype(np.float32),
21})
22
23audio = output[0].flatten()[:int(output[1][0])] # trim to valid lengthfp32 branch (kokoro-e2e.onnx.data, 310 MB).