CoolFace
Modelpublic

aufklarer/SpeechBrain-ECAPA-VoxLingua107-21M-MLX

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes53downloads
Model Card

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

PropertyValue
Parameters21.25 million
WeightsSafetensors, FLOAT16
Weight size40.6 MiB
InputSpeechBrain log-mel [1, frames, 60]
Sample rate16 kHz
Output107 log probabilities

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

FileDescription
model.safetensorsMLX-layout ECAPA and classifier weights
mlx_model.pyNative MLX ECAPA graph
frontend.pyReproducible SpeechBrain log-mel frontend
labels.jsonStable upstream index, code, and name mapping
config.jsonArchitecture, frontend, revisions, and checksums
artifact_manifest.jsonSHA-256 and size of every artifact file
validation.jsonPyTorch/MLX parity and local latency measurements
requirements.txtPinned standalone runtime dependencies
LICENSEApache 2.0 license

Validation

CheckResult
Minimum PyTorch/MLX output cosine1.000000
Maximum absolute error0.008958
Warm local inference5.3 ms

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

python
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

bash
speech language-id recording.wav --top 5

This 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