Downloads · 30 days
99
17% of all-time downloads
shawnahmed/Kokoro-82M-v1.0-ONNX-timestamped
Kokoro-82M-v1.0-ONNX-timestamped is a text-to-speech model from shawnahmed. Use it when you need text read aloud. It is set up for transformers.js. The card lists the license as apache-2.0.
This is onnx-community/Kokoro-82M-v1.0-ONNX with one change: the model's internal per-token duration tensor is exposed as a second graph output named preddur.
Downloads · 30 days
99
17% of all-time downloads
All-time downloads
587
Public
Repo size
2.3 GB
Likes
0
Public
Click a slice to open those files.
.onnx1.4 GB · 98%
From the Hugging Face model README
pred_dur)This is onnx-community/Kokoro-82M-v1.0-ONNX
with one change: the model's internal per-token duration tensor is exposed as a
second graph output named pred_dur.
Kokoro is a StyleTTS2-family model: its duration head computes exactly how many
audio frames each input token receives, and the vocoder renders precisely that.
The Python kokoro package surfaces these durations as token timestamps; the
stock ONNX export simply doesn't list the tensor as a graph output, so web
runtimes (kokoro-js / transformers.js) never see it. Exposing it enables
sample-accurate word timing (karaoke, RSVP, captions) with zero extra
inference cost.
Pure graph surgery with the onnx package — no re-export, no re-quantization:
the tensor /encoder/Clip_output_0 (the rounded, min-clamped per-token frame
count that feeds the alignment CumSum) is aliased through a Cast-to-float32
node to a new graph output pred_dur, shape [1, num_input_tokens]. The Cast
keeps the output float32 on every precision tier (the fp16 tiers carry it as
float16 internally, which browsers can't reliably read); the values are small
integer frame counts, so the cast is exact.
The waveform output is bit-identical to the stock export (verified for
every patched file).
Patched files: onnx/model.onnx (fp32), onnx/model_quantized.onnx (q8),
onnx/model_q4.onnx, onnx/model_q4f16.onnx. The remaining variants
(fp16, q8f16, uint8, uint8f16) are unmodified copies from the base repo.
Drop-in replacement — durations count frames of exactly 600 samples at 24 kHz,
but you never need that constant: audio.length / sum(pred_dur) is the
samples-per-frame at runtime.
const out = await model({ input_ids, style, speed }); // transformers.js
out.waveform; // identical to the stock model
out.pred_dur; // [1, T] frames per input token — cumulative sum = token start times
Patch script: export_timestamps.py
(in the Aloud repo, which uses this model for its neural karaoke).