Instructions to use k1ngtai/mms-1b-all-shn-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use k1ngtai/mms-1b-all-shn-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="k1ngtai/mms-1b-all-shn-v1")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForCTC processor = AutoProcessor.from_pretrained("k1ngtai/mms-1b-all-shn-v1") model = AutoModelForCTC.from_pretrained("k1ngtai/mms-1b-all-shn-v1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoProcessor, AutoModelForCTC
processor = AutoProcessor.from_pretrained("k1ngtai/mms-1b-all-shn-v1")
model = AutoModelForCTC.from_pretrained("k1ngtai/mms-1b-all-shn-v1", device_map="auto")Quick Links
mms-1b-all-shn-v1
facebook/mms-1b-all fine-tuned for Shan (shn) speech recognition (CTC, character vocabulary, target_lang="shn").
- Training mode:
top_layers(top 12 of 48 layers), 30 epochs, best checkpoint by CER - Data: NorHsangPha/Shan-ASR-Nova, shan-tts-dataset (Kaggle)
- License follows the base model (CC-BY-NC 4.0)
| metric | value |
|---|---|
| eval CER (greedy) | 3.63% |
| eval WER (greedy) | 55.00% |
| CER greedy (held-out half) | 15.81% |
| CER + 3-gram KenLM (held-out half, alpha=0.3, beta=0.0) | 34.80% |
WER is high because Shan word spacing is inconsistent - CER is the meaningful number.
Usage
import torch, librosa
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
proc = Wav2Vec2Processor.from_pretrained("k1ngtai/mms-1b-all-shn-v1")
proc.tokenizer.set_target_lang("shn")
model = Wav2Vec2ForCTC.from_pretrained("k1ngtai/mms-1b-all-shn-v1", target_lang="shn", ignore_mismatched_sizes=True).eval()
audio, _ = librosa.load("clip.wav", sr=16000)
inputs = proc(audio, sampling_rate=16000, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
print(proc.decode(logits.argmax(-1)[0]))
With the Shan language model (better accuracy)
# pip install pyctcdecode https://github.com/kpu/kenlm/archive/master.zip
from transformers import Wav2Vec2ProcessorWithLM
proc_lm = Wav2Vec2ProcessorWithLM.from_pretrained("k1ngtai/mms-1b-all-shn-v1")
print(proc_lm.batch_decode(logits.numpy()).text[0])
- Downloads last month
- 14
Model tree for k1ngtai/mms-1b-all-shn-v1
Base model
facebook/mms-1b-all
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="k1ngtai/mms-1b-all-shn-v1")