Instructions to use DevAmarnadh/Kokoro-82M-v1.0-ONNX-webgpu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use DevAmarnadh/Kokoro-82M-v1.0-ONNX-webgpu with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-to-speech', 'DevAmarnadh/Kokoro-82M-v1.0-ONNX-webgpu');
Kokoro-82M v1.0 ONNX, patched for WebGPU
This is onnx-community/Kokoro-82M-v1.0-ONNX (onnx/model.onnx, fp32) with one graph rewrite so it produces correct audio on onnxruntime-web's WebGPU backend.
The bug
ORT WebGPU's ConvTranspose gives wrong values for the vocoder upsampling layer generator/ups.1 (kernel 12, stride 6). The output keeps the correct length and duration, but every sample is wrong: peaks around 3e5 instead of about 0.6, and the audio is unintelligible. This was measured on AMD RDNA-3 with onnxruntime-web 1.22 and 1.30, via transformers.js 3.7.5, 3.8.1 and 4.3.0.
The fix
Each vocoder ConvTranspose is replaced with an identical zero-insertion upsample followed by an ordinary Conv (flipped, transposed kernel). On CPU the output matches the original (cosine similarity 1.0, max difference 1.5e-6). See fix_kokoro_webgpu.py.
| peak | rms | Moonshine transcript WER | |
|---|---|---|---|
| original, wasm | 0.559 | 0.069 | 0.11 |
| original, webgpu | 309315 | 767 | 1.0 (empty) |
| patched, webgpu | 0.555 | 0.068 | 0.11 (identical text) |
fp16 and q4f16 are not fixed by this change: they still produce NaN on WebGPU, which is a separate problem.
Usage (kokoro-js)
const tts = await KokoroTTS.from_pretrained('DevAmarnadh/Kokoro-82M-v1.0-ONNX-webgpu', { device: 'webgpu', dtype: 'fp32' });
Voice files still load from onnx-community/Kokoro-82M-v1.0-ONNX, which kokoro-js hardcodes, so they're unchanged.
- Downloads last month
- 35
Model tree for DevAmarnadh/Kokoro-82M-v1.0-ONNX-webgpu
Base model
yl4579/StyleTTS2-LJSpeech