Views
No views yet
<yo> </yo> <en> </en> at decode.| Metric | This (tag) | Plain baseline |
|---|---|---|
| WER tone-aware | 24.20% | 19.93% |
| WER tone-insensitive | 21.08% | 17.02% |
| CER tone-aware | 7.79% | 6.24% |
| Per-word LID accuracy | 99.41% | — |
1from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
2import torch, librosa
3repo = "LyngualLabs/yecs-asr-mms-lid"
4proc = Wav2Vec2Processor.from_pretrained(repo)
5proc.tokenizer.set_target_lang("yor") # MMS per-language vocab
6model = Wav2Vec2ForCTC.from_pretrained(repo).to("cuda").eval()
7a,_ = librosa.load("utt.wav", sr=16000)
8iv = proc(a, sampling_rate=16000, return_tensors="pt").input_values.to("cuda")
9ids = torch.argmax(model(iv).logits, dim=-1)
10txt = proc.batch_decode(ids)[0]
11for p,t in zip([chr(0xE000),chr(0xE001),chr(0xE002),chr(0xE003)], ["<yo>","</yo>","<en>","</en>"]):
12 txt = txt.replace(p, " "+t+" ")
13print(" ".join(txt.split()))