automatic-speech-recognition Β· audio Β· WASM (WebGPU when available) Β· ~240 MB
The English wav2vec2 demo speaks one language. This is its cross-lingual cousin: XLSR-53 was pre-trained on 53 languages (56,000 hours of multilingual audio) and then fine-tuned on Russian. That shared multilingual foundation is what makes a solid Russian recogniser trainable from a modest amount of labelled speech β the model already learned what human speech sounds like before it ever saw a Russian transcript. Same CTC mechanics as the English model, but the output alphabet is Cyrillic. Pick a clip and watch the frames collapse into Russian.
| Model | onnx-community/wav2vec2-large-xlsr-53-russian-ONNX (base: jonatasgrosman/wav2vec2-large-xlsr-53-russian) |
|---|---|
| Task / pipeline | automatic-speech-recognition β loaded as AutoModelForCTC so we can see the frames |
| Architecture | XLSR-53: wav2vec2-large cross-lingual encoder (24 transformer layers, ~315M params) pre-trained on 53 languages, fine-tuned for Russian. CTC head over a 39-symbol Cyrillic vocab (blank + "|" boundary + hyphen + 33 letters incl. Ρ). No decoder. |
| Language | Russian (ru) β this is a language-specialised recogniser; other languages produce Cyrillic gibberish |
| Quantization | q4 (4-bit) ONNX β onnx/model_q4.onnx (the q8/int8 exports of this model are degenerate; q4 is the honest runnable one) |
| Backend | WebAssembly (WebGPU when a real adapter is present), honest fallback |
| Download | ~240 MB (single encoder model), cached after first load |
| License | Apache-2.0 |
| Web APIs | WebAssembly / WebGPU, Web Workers, Web Audio (decode + resample), MediaRecorder (mic) |
Choose Russian 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. XLSR-53 does best on clear Russian speech.
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 Russian.
Below is the model's raw per-frame argmax: one cell per ~20 ms frame, showing the
single Cyrillic 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
Β·Β· ΠΏΠΏ Β·Β· ΡΡ Ρ Β·Β· ΠΈΠΈ collapses to ΠΏΡΠΈ.
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: XLSR-53 learns speech structure from 53 languages at once, so fine-tuning to a new language needs far fewer transcripts. That is what puts a usable Russian 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 Russian clip in, Cyrillic text out β and the per-frame strip that produced it.
Forced alignment: real per-word Russian timings, straight from the CTC frames.
Feed it English and watch cross-lingual transfer break down into Cyrillic phonetics.
Transcribe Russian with XLSR β OPUS-MT translates it to English, all on-device.
The one-liner is the ASR pipeline β but to see the frames we load the model directly and do the CTC collapse ourselves (which is exactly what the pipeline does internally):
import { AutoProcessor, AutoModelForCTC } from "@huggingface/transformers";
const model_id = "onnx-community/wav2vec2-large-xlsr-53-russian-ONNX";
const processor = await AutoProcessor.from_pretrained(model_id);
const model = await AutoModelForCTC.from_pretrained(model_id, {
device: "wasm", dtype: "q4", // q4 is the runnable export; q8/int8 are degenerate here
});
// audio = 16 kHz mono Float32Array
const inputs = await processor(audio);
const { logits } = await model(inputs); // shape [1, frames, 39] β 39 Cyrillic symbols
// greedy CTC decode: argmax per frame, merge duplicates, drop the blank (id 0)
const ids = argmaxPerFrame(logits); // e.g. [0,0,22,22,0,23,15,...]
const text = collapse(ids); // "ΠΏΡΠΈβ¦" in Cyrillic β 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.