automatic-speech-recognition · audio · WASM (WebGPU when available) · ~1.2 GB
The English wav2vec2 demo speaks one language, and the Russian XLSR demo speaks another. This is a third specialisation of the same cross-lingual cousin: XLSR-53 was pre-trained on 53 languages (56,000 hours of multilingual audio) and then fine-tuned on French. That shared foundation is what makes a solid French recogniser trainable from a modest amount of labelled speech — the model already learned what human speech sounds like before it ever saw a French transcript. Same CTC mechanics as the English and Russian models, but the output alphabet carries the full set of French diacritics (à â ç è é ê î ï ô ù û ü œ). Pick a clip and watch the frames collapse into French.
| Model | Poulpidot/wav2vec2-large-xlsr-53-french-onnx (base: jonatasgrosman/wav2vec2-large-xlsr-53-french) |
|---|---|
| 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 French. CTC head over a 59-symbol Latin-French vocab (blank + "|" boundary + apostrophe + hyphen + 26 letters + 29 accented forms incl. é è ê ç à â î ï ô ù û ü œ). No decoder. |
| Language | French (fr) — this is a language-specialised recogniser; other languages produce French-phonetic gibberish |
| Quantization | fp32 (full precision) ONNX — a single model.onnx at the repo root (no q8/q4 export exists for this model, so we load fp32 with subfolder:"") |
| Tokenizer | none shipped — this repo has no tokenizer.json, so we load the feature extractor with AutoFeatureExtractor and do the CTC decode ourselves from the model's vocab.json |
| Backend | WebAssembly (WebGPU when a real adapter is present), honest fallback |
| Download | ~1.2 GB (single fp32 encoder), cached after first load — a big one-time transfer |
| License | Apache-2.0 (base model) — the ONNX-export repo declares no license of its own |
| Web APIs | WebAssembly / WebGPU, Web Workers, Web Audio (decode + resample), MediaRecorder (mic) |
Choose French 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 French speech. Heads up: this model has no quantized export, so the first load is a ~1.2 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 French.
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
·· mm ·· aa a ·· ii ·· nn collapses to main.
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 French 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 French clip in, French text out — and the per-frame strip that produced it.
Forced alignment: real per-word French timings, straight from the CTC frames.
Feed it English and watch cross-lingual transfer break down into French phonetics.
Transcribe French with XLSR → OPUS-MT translates it to English, all on-device.
Normally the one-liner is the ASR pipeline — but this repo ships no tokenizer.json and
keeps its ONNX at the repo root, so we load the feature extractor + model directly and do the CTC
collapse ourselves (which is exactly what the pipeline does internally):
import { AutoFeatureExtractor, AutoModelForCTC } from "@huggingface/transformers";
const model_id = "Poulpidot/wav2vec2-large-xlsr-53-french-onnx";
const fe = await AutoFeatureExtractor.from_pretrained(model_id); // no tokenizer.json → feature extractor only
const model = await AutoModelForCTC.from_pretrained(model_id, {
device: "wasm", dtype: "fp32", // the only export is a single fp32 model.onnx…
subfolder: "", // …at the repo ROOT, not the usual onnx/ subfolder
});
// audio = 16 kHz mono Float32Array
const inputs = await fe(audio);
const { logits } = await model(inputs); // shape [1, frames, 59] ← 59 Latin-French symbols
// greedy CTC decode: argmax per frame, merge duplicates, drop the blank (id 0)
const ids = argmaxPerFrame(logits); // e.g. [0,0,19,19,0,7,15,20,...]
const text = collapse(ids); // "main…" in French — 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.