CoolFace
Modelpublic

DevAmarnadh/Kokoro-82M-v1.0-ONNX-webgpu

sourceHugging Faceapache-2.0updated 7d agoView on Hugging Face
1likes54downloads
Model Card

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.

peakrmsMoonshine transcript WER
original, wasm0.5590.0690.11
original, webgpu3093157671.0 (empty)
patched, webgpu0.5550.0680.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)

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.