Aller au contenu
ModelPrésentéExterne
Browse files

Kokoro 82M ONNX

Kokoro-82M converted to end-to-end ONNX graphs for on-device TTS inference on Android.

TypeOtherModèle de basehexgrad/Kokoro-82MVersionRevision a49a07fBClasse

Source du modèle

Type
Other
Taille du fichier
1,00 KB–3,47 MB
Modèle de base
hexgrad/Kokoro-82M
Version
vRevision a49a07f
Mis à jour
26 oct. 2026
Téléchargements
70
Source
Hugging Face

Description de la source

Kokoro 82M — ONNX

Kokoro-82M converted to end-to-end ONNX graphs for on-device TTS inference on Android.

Each graph fuses BERT → duration prediction → alignment → prosody → iSTFTNet decoder with fixed-shape I/O. The short-turn graph shares the same external weights as the full graph, so it adds only a small graph file rather than another 155 MB download.

Model

PropertyValue
Parameters82M
ArchitectureNon-autoregressive, single-pass
FormatONNX (opset 18)
Weights155 MB (FP16 storage → FP32 compute, shared external data)
Sample rate24 kHz
Max phonemes128
Max audio5s (120,000 samples)
Voices50+ (256-dim embeddings)
Languages8 (en, fr, es, ja, zh, ko, hi, pt)

Graph variants

GraphAudio tensorIntended 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.

Files

FileSizeDescription
kokoro-e2e.onnx3.5 MBFull-capacity model graph
kokoro-e2e-realtime.onnx2.9 MB3.0 s short-turn graph; shares the weights file below
kokoro-e2e.onnx.data155 MBModel weights (external data, FP16 storage)
vocab_index.json2 KBIPA phoneme → token ID mapping
us_gold.json1.5 MBPrimary pronunciation dictionary
us_silver.json3.2 MBFallback pronunciation dictionary
voices/*.bin1 KB eachVoice embeddings (256 × float32)

Tensors

Input

NameShapeTypeDescription
input_ids[1, 128]int64Phoneme token IDs (zero-padded)
attention_mask[1, 128]int641 for real tokens, 0 for padding
ref_s[1, 256]float32Voice style embedding
speed[1]float32Speed factor (1.0 = normal)
random_phases[1, 9]float32Initial harmonic phases (uniform [0,1))

Output (kokoro-e2e.onnx)

NameShapeTypeDescription
audio[1, 1, 120000]float32Raw PCM waveform (24 kHz)
audio_length_samples[1]int64Valid sample count (trim audio to this)
pred_dur[1, 128]float32Predicted phoneme durations

For kokoro-e2e-realtime.onnx, the audio output is [1, 1, 72000]; the other input and output tensors are unchanged.

Usage

import numpy as np
import onnxruntime as ort

sess = ort.InferenceSession("kokoro-e2e.onnx")

# Prepare inputs (phoneme IDs from vocab_index.json)
input_ids = np.zeros((1, 128), dtype=np.int64)
input_ids[0, :5] = [0, 60, 46, 79, 0]  # example phonemes
attention_mask = np.zeros((1, 128), dtype=np.int64)
attention_mask[0, :5] = 1

# Load voice embedding (256 floats from .bin file)
voice = np.fromfile("voices/af_heart.bin", dtype=np.float32).reshape(1, 256)

output = sess.run(None, {
    "input_ids": input_ids,
    "attention_mask": attention_mask,
    "ref_s": voice,
    "speed": np.ones(1, dtype=np.float32),
    "random_phases": np.random.rand(1, 9).astype(np.float32),
})

audio = output[0].flatten()[:int(output[1][0])]  # trim to valid length

Precision

Weights are stored as FP16 and cast to FP32 at use, so all computation runs in FP32 and the audio is bit-for-bit equivalent to the FP32 reference — verified by a TTS→ASR round-trip (identical transcriptions across full-length replies) with no length-dependent drift. This halves the download (310 → 155 MB) at no quality cost. Runtime memory is unchanged: ONNX Runtime materializes FP32 weights at session load.

Full-precision weights remain available on the fp32 branch (kokoro-e2e.onnx.data, 310 MB).

Source

Converted from hexgrad/Kokoro-82M using the E2E pipeline with FluidInference-aligned SineGen (segmented cumsum + phase wrapping).

Links


Sources

1 source
Hugging FacePrincipalVersion a49a07fb772d5281a42570e8645bf238f7f73bf2
huggingface.co/soniqo/Kokoro-82M-ONNX/tree/a49a07fb772d5281a42570e8645bf238f7f73bf2

Vérifié 26 oct.

Download files

Artefacts du modèle

19 artefacts

kokoro-e2e-realtime.onnx

onnx · 2,87 MB · SHA-256 313a2539eeb9…33da · Hugging Face

Download file

kokoro-e2e-small.onnx

onnx · 2,15 MB · SHA-256 ab54c7dd57d1…ee77 · Hugging Face

Download file

kokoro-e2e.onnx

onnx · 3,47 MB · SHA-256 e2cc97637ae4…075a · Hugging Face

Download file

voices/af_alloy.bin

bin · 1,00 KB · SHA-256 278f00c07ec7…6735 · Hugging Face

Download file

voices/af_bella.bin

bin · 1,00 KB · SHA-256 e863f4d0666b…fd33 · Hugging Face

Download file

voices/af_heart.bin

bin · 1,00 KB · SHA-256 3bc1d7444ad0…c191 · Hugging Face

Download file

voices/af_nicole.bin

bin · 1,00 KB · SHA-256 50210ee16885…2b45 · Hugging Face

Download file

voices/af_sky.bin

bin · 1,00 KB · SHA-256 8ccc56511090…2752 · Hugging Face

Download file

voices/am_adam.bin

bin · 1,00 KB · SHA-256 45d074f71795…11e9 · Hugging Face

Download file

voices/am_michael.bin

bin · 1,00 KB · SHA-256 452958c34f7f…d1aa · Hugging Face

Download file

voices/bf_emma.bin

bin · 1,00 KB · SHA-256 f8c1237e8146…21f5 · Hugging Face

Download file

voices/bm_george.bin

bin · 1,00 KB · SHA-256 fad0a6c39df1…1260 · Hugging Face

Download file

voices/ef_dora.bin

bin · 1,00 KB · SHA-256 8faf228a4337…c9cd · Hugging Face

Download file

voices/ff_siwis.bin

bin · 1,00 KB · SHA-256 1463f96b33b5…4405 · Hugging Face

Download file

voices/hf_alpha.bin

bin · 1,00 KB · SHA-256 3d0c56076ccb…c452 · Hugging Face

Download file

voices/if_sara.bin

bin · 1,00 KB · SHA-256 f779ef7bf9f9…46a2 · Hugging Face

Download file

voices/jf_alpha.bin

bin · 1,00 KB · SHA-256 9b54a3b0089b…b883 · Hugging Face

Download file

voices/pf_dora.bin

bin · 1,00 KB · SHA-256 da057fa319cd…2aea · Hugging Face

Download file

voices/zf_xiaobei.bin

bin · 1,00 KB · SHA-256 f5a0f42e321c…4aa1 · Hugging Face

Download file

Extraits de sources

3 extraits

--- license: apache-2.0 language: - en - fr - es - ja - zh - ko - hi - pt tags: - text-to-speech - onnx - android - on-device - kokoro base_model: hexgrad/Kokoro-82M library_name: onnxruntime pipeline_tag: text-to-speech --- # Kokoro 82M — ONNX [Kokoro-82M](https://huggingface.co/hexgrad/Kokoro-82M) converted to end-to-end ONNX graphs for on-device TTS inference on Android. Each graph fuses BERT → duration prediction → alignment → prosody → iSTFTNet decoder with fixed-shape I/O. The short-turn graph shares the same external weights as the full graph, so it adds only a small graph file rather than another 155 MB download. ## Model | 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 variants | 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. ## Files | 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) | ## Tensors ### Input | Name | Shape | Type | Description | |------|-------|------|-------------| | `input_ids` | `[1, 128]` | int64 | Phoneme token IDs (zero-padded) | | `attention_mask`...

Source context: 70 downloads · 1 likes · Pipeline text-to-speech · Library onnxruntime · Repo soniqo/Kokoro-82M-ONNX

Source context: 92 downloads · 1 likes · Pipeline text-to-speech · Library onnxruntime · Repo soniqo/Kokoro-82M-ONNX