audio-classification · audio · WASM · ~319 MB
This checkpoint listens to a voice and outputs one of two acoustic labels — “female” or “male” — learned from LibriSpeech audiobook narration. It reacts to how a recording is represented acoustically, not who a person is. Run it here, inspect the real logits, and use the non-operational exercises to audit sensitivity and limitations — never to identify or classify a person.
It is a binary acoustic voice-label classifier: a wav2vec2-large (XLS-R) model fine-tuned on LibriSpeech English audiobook speech to emit one of two labels from the sound of a voice. It is not a measure of anyone's gender identity — a model cannot know that from audio, and the binary label set itself erases non-binary people. LibriSpeech (audiobook readers) skews the training data by accent, age, language and recording conditions, so behaviour can vary across real-world recordings. The Wild page measures conditional sensitivity to a compound resampling transformation; it does not isolate a causal acoustic feature or say anything about identity.
Do not use this output to infer a person's gender or identity, and never for employment, access control, identity verification, safety, benefits, targeting, moderation of a person, or any other consequential decision about someone. Legitimate uses are education, media/dataset QA triage with human review, and research on acoustic bias. Everything runs on your device — no audio leaves the browser.
| Model (runs here) | Xenova/wav2vec2-large-xlsr-53-gender-recognition-librispeech (ONNX mirror, pinned revision 6bea1eddcfca9842add425123f4955d5b4f153f7) |
|---|---|
| Original checkpoint | alefiury/wav2vec2-large-xlsr-53-gender-recognition-librispeech (revision 7a28165f33e1dbb37adbce09c0a9afcd6095dd4d) — the Xenova repo is a converted mirror of it (base_model lineage) |
| Task / pipeline | audio-classification — Wav2Vec2ForSequenceClassification |
| Architecture | wav2vec2-large (XLS-R): CNN feature encoder + 24 transformer layers (hidden 1024), mean-pooled into a 2-way classification head; fine-tuned from facebook/wav2vec2-xls-r-300m |
| Labels (config id2label) | {0: "female", 1: "male"} — binary acoustic voice classes from the training data's labels |
| Training data | LibriSpeech (English audiobook narration; label skew and accent/age bias documented above) |
| Input | Raw 16 kHz mono waveform (no spectrogram — wav2vec2 reads samples directly) |
| Quantization | q8 (8-bit) ONNX — 318,834,205 bytes |
| Backend | WebAssembly fallback; WebGPU is tried when a real adapter exists. The ~319 MB download and hundreds of MB of runtime memory/storage can exceed constrained phones and browsers. |
| Download | ~319 MB, transferred once and cached in this browser; heavy on RAM while loaded (hundreds of MB) — may not suit low-memory phones |
| License | Apache-2.0 (canonical checkpoint) |
| Web APIs | WebAssembly, Web Workers, Web Audio, MediaRecorder, Cache Storage — all Baseline widely available |
Use the rights-reviewed LibriSpeech recording, drop an audio file, or record your own voice, then run the checkpoint. Every source is deterministically cropped or zero-padded to exactly 5.000 seconds at 16 kHz mono, matching the model card. The model returns both uncalibrated scores and raw logits. First use downloads ~319 MB with real progress.
Preprocessing contract: first 5.000 s; shorter input is zero-padded, longer input is cropped. The readout reports the fixed model input.
wav2vec2 doesn't look at a spectrogram — it reads the raw waveform. A small CNN turns the samples into feature frames (~50 per second), a 24-layer transformer builds context over them, the frames are mean-pooled, and a tiny linear head emits exactly two logits — one per label. A softmax turns those into the probabilities above. The numbers below are the real pre-softmax logits from your last run: their difference is all that decides the label, and the margin (|p₁ − p₂|) tells you how close the call was — the honest signal for “ask a human instead”.
| label id | label | raw logit | probability |
|---|
Voice-attribute checkpoints like this one exist all over the Hub, and they're easy to misuse. Running one honestly — on-device, with logits, score variation, and failure modes in the open — can reveal sensitivity to recording content and transformations. It cannot reveal identity or establish which acoustic feature caused an output. Appropriate uses are narrow:
It must not be used to infer anyone's gender or identity, or for employment, access, safety, benefits, targeting, moderation of a person, or any other consequential use.
Two labels, one clip — classify speech and learn to read probability, margin, and the abstention threshold.
MODEL-RISK exercise: audit within-utterance segment stability on one approved recording; report aggregate score variation only.
Conditional playback-rate resampling probe: measure probability deltas and whether the top label actually crosses.
No multi-model rung for this family — deliberately. The only obvious compositions (e.g. routing a voice to a “matching” TTS voice) would turn an acoustic label into an identity decision about a person, which this page explicitly prohibits. We don't ship that.
Classification is one pipeline call with Transformers.js. Feed a 16 kHz mono Float32Array:
import { pipeline } from "@huggingface/transformers";
const classify = await pipeline(
"audio-classification",
"Xenova/wav2vec2-large-xlsr-53-gender-recognition-librispeech",
{ dtype: "q8", revision: "6bea1eddcfca9842add425123f4955d5b4f153f7" },
);
const output = await classify(audio);
// audio = Float32Array @ 16 kHz mono (decode with the Web Audio API)
// → [{ label: "female", score: 0.9986 }, { label: "male", score: 0.0014 }]
This page decodes files / mic recordings to 16 kHz mono with an OfflineAudioContext,
runs the model inside a Web Worker so the UI never janks, and calls
processor + model directly so you see the exact pre-softmax logits,
not just the post-processed scores.