Views
No views yet
stabilityai/stable-audio-3-small-music
autoencoder, exported to ONNX so audio can be turned into latents in the browser
via onnxruntime-web.lsb/stable-audio-3-small-music-onnx:
the decoder maps latents → audio, this maps audio → latents. Together they enable
audio-to-audio (variation), inpainting, and continuation on top of that text-to-music bundle.patchify (patch_size=256) → SAME encoder (taae_v2) → softnorm bottleneck.
Linear/MatMul weights are quantized to int4 MatMulNBits (block_size=32, symmetric);
convolutions and norms stay fp32. Single file, no external data.input audio float32 (1, 2, N) stereo, 44.1 kHz, N a multiple of 8192
output latents float32 (1, 256, N/4096) same latent space as the decoder's inputN must be a multiple of 8192 samples (the model's audio_align, so the latent length
t_lat = N/4096 is even). Pad shorter clips with zeros; the latent is laid out in time, so
you can trim trailing latent frames that correspond to the padding.1import * as ort from "onnxruntime-web/wasm";
2ort.env.wasm.numThreads = 1; ort.env.wasm.simd = true;
3
4const base = "https://huggingface.co/bgkb/onnx-encoder/resolve/main";
5const buf = new Uint8Array(await (await fetch(`${base}/encoder_q4.onnx`)).arrayBuffer());
6const sess = await ort.InferenceSession.create(buf, { executionProviders: ["wasm"] });
7
8// audio: Float32Array of interleaved-by-channel data [L(0..N-1), R(0..N-1)], N % 8192 === 0
9const latents = (await sess.run({ audio: new ort.Tensor("float32", audio, [1, 2, N]) })).latents;
10// → feed latents to the diffusion (variation) or straight to the decoder (round-trip)| precision | size | reconstruction SNR |
|---|---|---|
| fp32 | 215 MB | 10.2 dB |
| int4 (this file) | 36 MB | 8.2 dB |