Klang Pianissimo for Danish: ONNX
ONNX versions of Klang Pianissimo for Danish, our Danish speech recognition model. They run on an ordinary CPU with onnxruntime, without PyTorch or NeMo.
Versions
| Version | Download | FLEURS test | Speed, Intel | Speed, ARM | Speed, Mac | Memory, 30 s clip |
|---|---|---|---|---|---|---|
| Original fp32 | 2.51 GB | 7.43 | ||||
| int8 | 684 MB | 7.60 | 35ร | 63ร | 74ร | 1.5 GB |
| int4 | 525 MB | 7.98 | 12ร | 23ร | 37ร | 1.1 GB |
| fp16 | 1.46 GB | 7.43 | 18ร | 30ร | 55ร | 4.0 GB |
| fp32 | 2.56 GB | 7.43 | 18ร | 30ร | 55ร | 3.0 GB |
The FLEURS column shows word error rate (WER, %) on all 930 Danish test clips, scored with our evaluation normaliser; lower is better. Speed is audio duration divided by processing time (RTFx), measured on a 30-second clip. Speed and memory were measured on the Swedish model, which has the same architecture. CPU benchmarks used 4 threads on an Intel Xeon Platinum 8481C, 8 threads on a Google Axion (ARM) and 6 threads on an Apple M5 Pro. Memory was measured on the Intel Xeon.
On a Mac, the MLX versions run on the GPU and are about twice as fast.
Usage
Install onnx-asr:
pip install onnx-asr[cpu,hub]
Transcribe a 16 kHz mono WAV file:
import onnx_asr
model = onnx_asr.load_model("KlangAI/pianissimo-da-onnx", quantization="int8")
print(model.recognize("audio.wav"))
Only the files for the chosen version are downloaded. Use quantization="int4" or "fp16", or leave it out for fp32.
With timestamps:
result = model.with_timestamps().recognize("audio.wav")
print(result.text)
for token, start in zip(result.tokens, result.timestamps):
print(f"{start:6.2f} {token}")
Long recordings
The transcribe_long helper included in this repository splits long recordings at quiet moments; install its audio dependency with pip install soundfile:
import sys
from huggingface_hub import snapshot_download
path = snapshot_download("KlangAI/pianissimo-da-onnx", allow_patterns=["*.py", "tokenizer.model"])
sys.path.append(path)
import pianissimo_onnx
for start, end, text in pianissimo_onnx.transcribe_long(model, "long.wav"):
print(f"[{start:7.1f}s] {text}")
onnx-asr can also split at pauses with voice activity detection (model.with_vad(onnx_asr.load_vad("silero"))). It produces shorter segments, which improved accuracy on noisy broadcast audio but reduced it on clean speech in our tests.
Vocabulary
Our implementation of NeMo's phrase boosting supports custom vocabulary and matches NeMo's results on the original model. List names and terms to help the model spell them correctly. Install sentencepiece with pip install sentencepiece.
import sys
from huggingface_hub import snapshot_download
path = snapshot_download(
"KlangAI/pianissimo-da-onnx",
allow_patterns=["*.py", "tokenizer.model"],
)
sys.path.append(path)
import pianissimo_onnx
vocabulary = ["Klang AI", "Pianissimo", "Folketinget", "Aarhus Universitet"]
pianissimo_onnx.boost(model, vocabulary)
print(model.recognize("audio.wav"))
See the main model card for vocabulary boosting with NeMo.
Files
| File | Contents |
|---|---|
encoder-model{.int8,.int4,.fp16,}.onnx |
Encoder. The fp32 weights are in encoder-model.onnx.data. |
decoder_joint-model{.int8,.int4,.fp16,}.onnx |
Decoder |
vocab.txt |
The 8,192 tokens, plus the blank token |
nemo128.onnx |
Converts audio to the 128-band spectrogram the encoder expects |
config.json |
Settings for onnx-asr |
How they were made
All versions are exported from the released checkpoint and retain its local attention (256 frames on each side).
- int8: weights and calculations in 8 bits. Before quantizing, part of the scale of each layer's input is moved into its weights (SmoothQuant), which makes the 8-bit version more accurate. The decoder's LSTM is stored in fp16.
- int4: weights in 4 bits, in groups of 32 with a scale and offset per group chosen with HQQ. Calculations are done in fp32. Plain rounding to 4 bits was about 1 percentage point worse on the Danish test sets. The int4 encoder's offsets are stored as whole numbers plus a small exact correction, so it also runs on WebGPU in the browser (onnxruntime-web).
- fp16: weights stored in fp16.
FLEURS WER was measured with onnxruntime 1.24.1 on the CPU. See the main model card for comparisons with other models.
License and citation
Released under CC BY 4.0, like the original model.
@misc{klang2026pianissimoda,
title = {Klang Pianissimo for Danish},
author = {{Klang}},
year = {2026},
howpublished = {Hugging Face model repository},
url = {https://huggingface.co/KlangAI/pianissimo-da}
}
- Downloads last month
- -