aufklarer/SpeechBrain-ECAPA-VoxLingua107-21M-MLX
SpeechBrain ECAPA VoxLingua107 MLX
This is a pinned, validated MLX export of `speechbrain/lang-id-voxlingua107-ecapa` for native Apple Silicon inference. It ranks 107 spoken-language labels.
Model
The runtime contract includes sentence-level mean normalization. The exporter compares an independent periodic-Hamming, symmetric-filter frontend with the official SpeechBrain implementation before accepting the weights.
Files
Validation
The upstream card reports 6.7% error on a small 33-language development subset, not a complete test over all 107 labels. Product evaluation should use the intended languages, accents, microphones, noise, and short-utterance mix.
Standalone MLX
import json
import mlx.core as mx
import soundfile as sf
from frontend import compute_fbank
from mlx_model import LanguageIDModel
audio, sample_rate = sf.read("recording.wav", dtype="float32")
assert sample_rate == 16000 and audio.ndim == 1
features = compute_fbank(audio, 60)[None, :, :]
model = LanguageIDModel()
model.load_weights(list(mx.load("model.safetensors").items()), strict=True)
log_probabilities = model(mx.array(features))
mx.eval(log_probabilities)
labels = json.load(open("labels.json", encoding="utf-8"))
best = int(mx.argmax(log_probabilities, axis=-1).item())
print(labels[best], float(mx.exp(log_probabilities[0, best]).item()))speech-swift
speech language-id recording.wav --top 5This is a closed-set classifier and is not an unknown-language detector. Keep the original class indexes; normalized aliases belong in application output, not in the model head.
Source
Converted from the official SpeechBrain checkpoint at revision 0253049ae131d6a4be1c4f0d8b0ff483a0f8c8e9. Source and checkpoint hashes are in config.json.
Links
- speech-swift — Apple SDK
- Docs — install and CLI docs
- soniqo.audio
- blog
