Run this model with HF Jobs
Run DimQ1/sortformer-4spk-v2-onnx-int8-cpu on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/DimQ1/sortformer-4spk-v2-onnx-int8-cpu. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/DimQ1/sortformer-4spk-v2-onnx-int8-cpu on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use DimQ1/sortformer-4spk-v2-onnx-int8-cpu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- NeMo
How to use DimQ1/sortformer-4spk-v2-onnx-int8-cpu with NeMo:
# tag did not correspond to a valid NeMo domain.
- Notebooks
- Google Colab
- Kaggle
Sortformer 4spk-v2 β ONNX INT8 (CPU, MatMulNBits)
INT8 quantized ONNX model of NVIDIA's Sortformer 4spk-v2 speaker diarization. Uses MatMulNBits (ORT β₯ 1.18) for real 8-bit weight compression.
Model Details
- Base model: nvidia/diar_streaming_sortformer_4spk-v2
- Format: ONNX opset 21, INT8 MatMulNBits (block_size=64, symmetric)
- Parameters: 117.7 M (weights: 8-bit)
- File size: 129 MB total (21 MB ONNX + 109 MB external data)
- Quantizable MatMul nodes: 265 of 352 (87 attention-score MatMuls kept FP32)
- Input:
processed_signalβ log-mel spectrogram [B, 128, mel_frames] - Output:
speaker_logitsβ per-frame sigmoid probabilities [B, diar_frames, 4] - Diar frame rate: 80 ms (10 ms mel stride / 8Γ subsampling)
Architecture
Audio (16 kHz mono) β STFT β 128 mel bins
β ConformerEncoder (17 layers, d=512)
β SortformerModules (4 speakers)
β TransformerEncoder (18 layers, d=192)
β Sigmoid β [B, diar_frames, 4] speaker logits
All 265 constant-weight MatMul nodes replaced with MatMulNBits (INT8, block_size=64). 87 dynamic MatMul nodes (attention scores) remain in FP32.
Performance (CPU, 12 threads, ORT 1.27.1)
| Metric | Value |
|---|---|
| RTF | 0.034 (29.4Γ real-time) |
| DER | 21.64% (LibriCSS test set) |
| Size | 129 MB (3.6Γ smaller than FP32) |
| cos_sim vs FP32 | 0.989β0.999 |
Benchmarked on 100-file LibriCSS subset (1954.8 s audio). ORT 1.27.1 with ORT_PARALLEL + memory optimizations.
π INT8 is the fastest variant β 29.4Γ real-time on 12-core CPU (66.6 s for 1954.8 s audio).
Other Variants
| Variant | Size | DER | RTF | Link |
|---|---|---|---|---|
| FP32 | 469 MB | 17.82% | 0.037 | sortformer-4spk-v2-onnx-fp32-cpu |
| INT4 | 135 MB | 19.11% | 0.043 | sortformer-4spk-v2-onnx-int4-cpu |
Requirements
- ONNX Runtime β₯ 1.18 (MatMulNBits support)
- CPU Execution Provider
.datafile must be in the same directory assortformer.onnx
Usage
Python
import onnxruntime as ort
session = ort.InferenceSession(
"sortformer.onnx",
providers=["CPUExecutionProvider"],
)
speaker_logits = session.run(None, {"processed_signal": mel})[0]
C#
using var session = new InferenceSession("sortformer.onnx");
var inputs = new List<NamedOnnxValue>
{
NamedOnnxValue.CreateFromTensor("processed_signal", melTensor),
};
using var results = session.Run(inputs);
Conversion
Quantized from FP32 ONNX using MatMulNBitsQuantizer (ORT β₯ 1.18, opset 21):
python scripts/quantize_nbits.py --int8
See nemotron-speech-csharp/DiarizationConverter