alaleye/fon
Viewer • Updated • 10.4k • 70
How to use inesassia/fonbench-mms-1b-fon-lora with PEFT:
Task type is invalid.
LoRA (Low-Rank Adaptation) of facebook/mms-1b-all for the Fon language (tonal Gbe language of Benin), training only 0.82 % of the model parameters.
fon, ISO 639-3)Same as the full fine-tuned variant: not suitable for noisy/far-field audio, code-switching, other languages, or safety-critical applications.
from peft import PeftModel
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import torch, librosa
# Important: vocab_size must be set to 53 (Fon vocabulary)
processor = Wav2Vec2Processor.from_pretrained("inesassia/fonbench-mms-1b-fon-lora")
base = Wav2Vec2ForCTC.from_pretrained(
"facebook/mms-1b-all",
vocab_size=len(processor.tokenizer),
ignore_mismatched_sizes=True,
pad_token_id=processor.tokenizer.pad_token_id,
)
model = PeftModel.from_pretrained(base, "inesassia/fonbench-mms-1b-fon-lora")
model.eval()
# Audio must be 16 kHz mono
audio, sr = librosa.load("audio.wav", sr=16000)
inputs = processor(audio, sampling_rate=16000, return_tensors="pt")
with torch.no_grad():
logits = model(inputs.input_values).logits
pred_ids = torch.argmax(logits, dim=-1)
transcription = processor.batch_decode(pred_ids)[0]
print(transcription)
Same as FT-2: 5,488 training examples (20 speakers) from alaleye/fon. Test set: 3,541 examples, 7 unseen speakers (strict speaker stratification).
| Hyperparameter | Value |
|---|---|
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| LoRA dropout | 0.0 |
| Target modules | q_proj, v_proj |
| Task type | CTC |
| Bias adaptation | None |
| Hyperparameter | Value |
|---|---|
| Strategy | LoRA (PEFT) |
| Optimizer | AdamW |
| Learning rate | 2e-4 |
| Batch size (per device) | 8 |
| Gradient accumulation steps | 2 |
| Effective batch size | 16 |
| Epochs | 5 |
| Early stopping patience | 2 |
| Precision | fp16 mixed precision |
| Gradient checkpointing | Enabled |
| Random seed | 42 |
| Metric | Value |
|---|---|
| WER (test) | 28.75 % |
| CER (test) | 8.18 % |
| Variant | Params trained | WER | Δ vs FT-2 |
|---|---|---|---|
| LoRA-1 (r=8) | 2.0M (0.21%) | 32.20% | +12.93 pts |
| This model (r=32) | 7.9M (0.82%) | 28.75 % | +9.48 pts |
| FT-1 (LR 1e-5) | 967M (100%) | 24.32% | +5.05 pts |
| FT-2 (LR 5e-5) | 967M (100%) | 19.27% | — (best) |
Trade-off: LoRA-2 achieves a WER within ~10 points of full fine-tuning while training only 0.82% of the parameters, making it a strong choice for compute-constrained deployments.
All limitations of the full fine-tuned variant apply, plus:
facebook/mms-1b-all with a custom vocabulary head (53 tokens). The reload code above must be used verbatim.@mastersthesis{hounkponou2026fonbench,
title={Evaluation and adaptation of automatic speech recognition models for the Fon language},
author={Hounkponou, Inès Assia},
school={ESGIS Bénin},
year={2026}
}
Base model
facebook/mms-1b-all