ReDimNet2-ONNX
fast speaker verification without PyTorch
2 min readupdated
An unofficial ONNX build of all 20 checkpoints from the ReDimNet2 model family (by PalabraAI, Interspeech 2026) for running on CPU and GPU via ONNX Runtime with zero PyTorch dependencies. The model takes 16 kHz mono audio and outputs a 192-dimensional embedding (a numerical voice vector), with mel-spectrogram calculation baked straight into the graph. You can compare recordings using the cosine similarity of the resulting vectors. This repo is ideal for developers who need lightweight, fast voice recognition or verification in production.
Key features
- Full set of weights: all 20 variants are available, ranging from the compact B0 (1.1M parameters) to the large B6 (12.5M), trained on VoxCeleb2, VoxBlink2, and CN-Celeb2.
- CPU speedup: FP32 graphs run 1.8–2.6x faster than the original PyTorch implementation while delivering virtually identical outputs (relative difference ~1e-6).
- GPU optimization: FP16 versions are 21–42% smaller and run up to 2x faster than FP32 on long recordings or batches.
- Built-in preprocessing: the graph handles mel-spectrogram computation and volume normalization on its own, supporting dynamic audio lengths and batch sizes.
What you can do
- Voice authentication: integrate speaker identity verification into a server-side service or bot without dragging in a heavy PyTorch environment.
- Speaker search and clustering: extract embeddings from audio recordings and group speech segments by voice using cosine similarity.
- Local CPU inference: use lightweight models like
b0-vox2-lmorb3-vox2-lmto process short phrases quickly on a standard processor.
Example
import numpy as np, onnxruntime as ort, soundfile as sf, soxr
from huggingface_hub import hf_hub_download
path = hf_hub_download("lzrhahahahaha/ReDimNet2-ONNX", "fp32/b6-vox2-lm.onnx")
model = ort.InferenceSession(path, providers=["CPUExecutionProvider"])
audio, rate = sf.read("first.wav", dtype="float32", always_2d=True)
audio = soxr.resample(audio.mean(axis=1), rate, 16000)
emb = model.run(None, {"input_values": audio[None]})[0][0] # вектор [192]
Read more
DetailsCheckpoints with the
lm suffix (after large-margin fine-tuning) are recommended; the minimum clip length is 720 samples (45 ms), though accuracy is noticeably higher on segments lasting a few seconds.In benchmarks (Intel Core i5-14400 / RTX 4070 SUPER), processing a 7–9 s clip with B6-LM takes 361.1 ms on CPU (compared to 762.5 ms in PyTorch) and 21.1 ms on GPU in FP16.
Limitations: when running in batches, all clips in a single batch must be the exact same length (there is no padding mask), and for
cnc2 checkpoints on CPU, you should enable the session.set_denormal_as_zero=1 option.









Comments