MioCodec-25Hz-44.1kHz-v2 β ONNX (WebGPU-ready)
Browser-runnable ONNX export of Aratako/MioCodec-25Hz-44.1kHz-v2,
a 25 Hz / 341 bps neural audio codec (WavLM-base+ encoder, iSTFTHead decoder, 44.1 kHz output).
Two graphs, split so the browser can load only what it needs:
| file | size | inputs | outputs |
|---|---|---|---|
encoder.fp16.onnx |
~248 MB | waveform f32 (1, N) @ 44.1 kHz |
tokens i32 (1, T) @ 25 Hz, global f32 (1, 128) |
decoder.fp16.onnx |
~168 MB | tokens i32 (1, T), global f32 (1, 128) |
waveform f32 (1, L) @ 44.1 kHz |
Weights are stored as fp16 with a Cast to fp32, so the files are half the size while all arithmetic still happens in float32. The FSQ quantiser and the iSTFT tables stay fp32 so tokenisation and synthesis remain stable. Both graphs have a dynamic sequence length.
Export notes
The reference implementation needed four rewrites to be ONNX/WebGPU-friendly; each is numerically equivalent (verified against the PyTorch model: identical tokens, identical speaker embedding, waveform max abs diff ~4e-6):
- RoPE without
view_as_complex/polar(interleaved pairs, computed from cos/sin tables stored as graph constants and sliced by the runtime length). - Windowed attention without
triu/tril/FlashAttention: an additive bias built from a position vector, then explicitmatmul+softmax. - iSTFT without
torch.fft.irfft/F.fold: oneConvTranspose1dwhose kernel is the real inverse-DFT matrix folded with the Hann window, plus the same convolution of an all-ones frame for the window envelope. - FSQ code<->index arithmetic in float32 instead of float64/int64 (exact for levels 8/8/8/5/5).
The encoder expects the waveform to carry the symmetric padding that
MioCodecModel._calculate_waveform_padding applies (111 samples per side for a 3 s clip);
the demo computes it in JS.
MIT, inherited from the upstream model.
Model tree for ankit-pn/MioCodec-25Hz-44.1kHz-v2-ONNX
Base model
Aratako/MioCodec-25Hz-24kHz