Romanized Idu Mishmi CTC ASR adapter for
facebook/mms-1b-all.
Data source & attribution. The training and evaluation data is derived from the
ARTPARK-IISc Vaani project (
https://vaani.iisc.ac.in/), released under
CC-BY-4.0. Please retain that attribution when you use these models.
1# pip install "transformers>=5" huggingface_hub safetensors torch
2from transformers import (Wav2Vec2ForCTC, Wav2Vec2Config,
3 Wav2Vec2CTCTokenizer, Wav2Vec2Processor,
4 AutoFeatureExtractor)
5from huggingface_hub import hf_hub_download
6from huggingface_hub.utils import EntryNotFoundError
7from safetensors.torch import load_file
8import json, torch
9
10BASE = "facebook/mms-1b-all"
11
12def load_ne_asr(repo_id, iso):
13 # Reads the per-language adapter dim from the repo's meta sidecar
14 # (64 for lus/grt, 16 otherwise; falls back to 16 if absent).
15 try:
16 meta = json.load(open(hf_hub_download(repo_id, f"adapter.{iso}.meta.json")))
17 dim = int(meta.get("adapter_attn_dim", 16))
18 except EntryNotFoundError:
19 dim = 16
20 tok = Wav2Vec2CTCTokenizer.from_pretrained(repo_id)
21 feat = AutoFeatureExtractor.from_pretrained(BASE) # MMS's own feature extractor
22 processor = Wav2Vec2Processor(feature_extractor=feat, tokenizer=tok)
23
24 cfg = Wav2Vec2Config.from_pretrained(BASE)
25 cfg.adapter_attn_dim = dim
26 cfg.vocab_size = len(tok)
27 cfg.pad_token_id = tok.pad_token_id
28 cfg.ctc_zero_infinity = True
29
30 model = Wav2Vec2ForCTC.from_pretrained(BASE, config=cfg, # frozen ~1B base (~3.6GB, once)
31 ignore_mismatched_sizes=True)
32 model.init_adapter_layers()
33 state = load_file(hf_hub_download(repo_id, f"adapter.{iso}.safetensors"))
34 model.load_state_dict(state, strict=False) # base from mms-1b-all; adapter+head from repo
35 return model.eval(), processor
36
37# --- usage (replace with this repo's id + iso) ---
38model, processor = load_ne_asr("sulabhkatiyar/ne-asr-clk", "clk")
39
40import torchaudio
41wav, sr = torchaudio.load("example.wav")
42if sr != 16000:
43 wav = torchaudio.functional.resample(wav, sr, 16000)
44inputs = processor(wav.squeeze().numpy(), sampling_rate=16000, return_tensors="pt")
45with torch.no_grad():
46 logits = model(inputs.input_values).logits
47pred = processor.batch_decode(logits.argmax(-1))[0]
48print(pred)
1@article{pratap2023scaling,
2 title = {Scaling Speech Technology to 1,000+ Languages},
3 author = {Pratap, Vineel and Tjandra, Andros and Shi, Bowen and Tomasello, Paden and Babu, Arun and Kundu, Sayani and Elkahky, Ali and Ni, Zhaoheng and Vyas, Apoorv and Fazel-Zarandi, Maryam and Baevski, Alexei and Adi, Yossi and Zhang, Xiaohui and Hsu, Wei-Ning and Conneau, Alexis and Auli, Michael},
4 journal = {arXiv preprint arXiv:2305.13516},
5 year = {2023}
6}
And the NE-ASR adapter release (placeholder; replace when the canonical publication is available):
1@misc{katiyar2026neasr,
2 author = {Katiyar, Sulabh},
3 title = {NE-ASR: MMS-1B Adapters for Northeast Indian Languages},
4 year = {2026},
5 howpublished = {\url{https://huggingface.co/sulabhkatiyar/ne-asr-clk}},
6 note = {Placeholder citation; replace with the canonical publication when available.}
7}
CC-BY-NC-4.0. This adapter is derived from
facebook/mms-1b-all, released under
CC-BY-NC 4.0. When you use this adapter you must comply with the MMS license terms.
The underlying training and evaluation data is derived from the ARTPARK-IISc Vaani
project (
https://vaani.iisc.ac.in/), released under CC-BY-4.0; please also retain that
attribution.