automatic-speech-recognition · audio · WASM (WebGPU when available) · ~1.26 GB
The Russian XLSR, Thai XLSR and other demos here are XLSR-53 fine-tunes. This one is a close cousin, but honestly not the same checkpoint: neither jonatasgrosman's nor aapot's Finnish XLSR-53 model ships a browser-loadable ONNX, so a true Finnish XLSR-53 can't run in a tab today. What can run is Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish: a wav2vec2-large model pre-trained on the VoxPopuli Uralic-languages subset (a different cross-lingual pretraining than XLSR-53) and fine-tuned on Finnish. Same CTC mechanics; the output alphabet is the 34-symbol Latin-Finnish set (a–z + ä å ö). Pick a clip and watch the frames collapse into Finnish.
| Model | KalleLaht/wav2vec2-large-uralic-voxpopuli-v2-finnish-ONNX (ONNX export of base: Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish) |
|---|---|
| Task / pipeline | automatic-speech-recognition — loaded as AutoModelForCTC so we can see the frames |
| Architecture | wav2vec2-large (24 transformer layers, ~315M params) pre-trained on the VoxPopuli Uralic subset, fine-tuned for Finnish. CTC head over a 34-symbol Latin-Finnish vocab (blank [PAD] + | word boundary + a–z + ä å ö + [UNK] + <s>/</s>). No decoder. |
| Not XLSR-53 | Honest note: this is not the wav2vec2-large-XLSR-53 checkpoint. jonatasgrosman/aapot Finnish XLSR-53 models are safetensors-only (no browser ONNX), so a true Finnish XLSR-53 can't run in a browser today. This VoxPopuli-Uralic model is a different (but closely related, cross-lingual) wav2vec2-large pretraining — named for exactly what it is. |
| Language | Finnish (fi) — a language-specialised recogniser; other languages produce Finnish-phonetic gibberish |
| Quantization | fp32 (full precision) ONNX — a single wav2vec2_model.onnx at the repo root (no q8/q4 export exists, so we load fp32 with subfolder:"" + model_file_name) |
| Config & inputs | the ONNX-export repo ships no config.json, so we load the architecture config from the base Finnish-NLP repo, normalise the audio ourselves, and CTC-decode from the base repo's 34-symbol vocab. The graph has two inputs: input_values (float32) and attention_mask (int32, all-ones for a single clip). |
| Backend | WebAssembly (WebGPU when a real adapter is present), honest fallback |
| Download | ~1.26 GB (single fp32 encoder), cached after first load — a big one-time transfer |
| License | Apache-2.0 (base Finnish-NLP model; the ONNX-export repo declares none of its own) |
| Web APIs | WebAssembly / WebGPU, Web Workers, Web Audio (decode + resample), MediaRecorder (mic) |
Choose Finnish audio — record from your mic, upload a file, or pick the bundled sample. The page decodes it to 16 kHz mono, draws the waveform, and runs the CTC model in a Web Worker. It does best on clear Finnish speech. Heads up: this model has no quantized export, so the first load is a ~1.26 GB fp32 download.
This context didn't grant mic access (common in headless / embedded views). The model still works — use the sample above or Upload audio. For live recording, open this in a normal browser tab and allow the microphone when prompted, then speak Finnish.
Below is the model's raw per-frame argmax: one cell per ~20 ms frame, showing the
single character it thinks is most likely there. Most frames are blank (·) — the model
saying "nothing new here". Where a sound lands you get a run of the same letter. The transcript is
produced by two mechanical rules, no decoder involved:
(1) merge consecutive duplicates, (2) drop the blanks. A run like
·· hh ·· ei collapses to hei.
Raw per-frame argmax (– frames · ~– ms each):
↓ merge duplicates, drop blanks ↓
Most of the world's ~7,000 languages have little labelled speech data. Cross-lingual self-supervised pre-training is how the field reaches them: this model learned speech structure from the Uralic languages in VoxPopuli, so fine-tuning to Finnish needed far fewer transcripts. That is what puts a usable Finnish recogniser inside a browser tab — private, offline once cached, no server, no key. And because it's CTC (frames, not generated tokens) it can't hallucinate an unspoken sentence, and every character is pinned to a moment in time.
One Finnish clip in, Finnish text out — and the per-frame strip that produced it.
Forced alignment: real per-word Finnish timings, straight from the CTC frames.
Feed it English and watch cross-lingual transfer break down into Finnish phonetics.
Transcribe Finnish → OPUS-MT translates it to English, all on-device.
Normally the one-liner is the ASR pipeline — but this repo ships no config.json and
keeps its ONNX at the repo root, so we load the model with a config borrowed from the base repo,
normalise the audio ourselves, and do the CTC collapse (which is exactly what the pipeline does
internally):
import { AutoConfig, AutoModelForCTC, Tensor } from "@huggingface/transformers";
const model_id = "KalleLaht/wav2vec2-large-uralic-voxpopuli-v2-finnish-ONNX";
// the export repo has no config.json → borrow the architecture config from the base repo
const config = await AutoConfig.from_pretrained("Finnish-NLP/wav2vec2-large-uralic-voxpopuli-v2-finnish");
const model = await AutoModelForCTC.from_pretrained(model_id, {
device: "wasm", dtype: "fp32", // the only export is a single fp32 file…
subfolder: "", // …at the repo ROOT…
model_file_name: "wav2vec2_model", // …under this name
config,
});
// audio = 16 kHz mono Float32Array → normalise to zero mean / unit variance (wav2vec2 feature step)
const x = normalize(audio);
// this graph needs BOTH input_values and an int32 attention_mask (all-ones for a single clip)
const { logits } = await model({
input_values: new Tensor("float32", x, [1, x.length]),
attention_mask: new Tensor("int32", new Int32Array(x.length).fill(1), [1, x.length]),
});
// logits shape [1, frames, 34] ← 34 Latin-Finnish symbols
// greedy CTC decode: argmax per frame, merge duplicates, drop the blank ([PAD]=31); | → space
const ids = argmaxPerFrame(logits);
const text = collapse(ids); // "hei…" in Finnish — no decoder involved
Inference runs in a Web Worker so the UI never janks. The worker returns the raw per-frame argmax and real per-word timings (from the frame each character was emitted at) — nothing is faked or pre-computed.