Views
No views yet
sarvamai/sarvam-1
(2B) that performs Text Normalization (TN) for code-mixed Hindi/English
text — turning written forms into the spoken form a TTS acoustic model needs
(acronyms → phonetic letters, IDs/phone numbers → digit-by-digit, times, dates,
currency, units, percentages), while preserving the Hindi/English code-mix.sarvam-1 is a base (non-instruct) model and cannot be reliably
prompted into TN (12-shot ICL scores 49.9% WER — worse than rules). This
adapter is fine-tuned on a synthetic, correct-by-construction code-mixed corpus.| System | WER ↓ | CER ↓ | Exact-Match ↑ |
|---|---|---|---|
naive rules (indic-numtowords) | 43.6% | 43.7% | 0% |
| competitive rule engine | 20.9% | 17.5% | 27.5% |
| Sarvam-1 base (12-shot ICL) | 49.9% | 35.4% | 5% |
| this adapter | 7.96% | 6.37% | 62.5% |
1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4tok = AutoTokenizer.from_pretrained("sarvamai/sarvam-1")
5m = AutoModelForCausalLM.from_pretrained("sarvamai/sarvam-1")
6m = PeftModel.from_pretrained(m, "AK04-IXR/sarvam1-hinglish-tn-lora")
7
8prompt = "Input: Mera flight ticket PNR-8392 hai, aur departure 4:30 PM ko hai.\nOutput:"
9ids = tok(prompt, return_tensors="pt").to(m.device)
10out = m.generate(**ids, max_new_tokens=96, do_sample=False)
11print(tok.decode(out[0][ids['input_ids'].shape[1]:], skip_special_tokens=True))
12# -> Mera flight ticket pee-en-aar eight three nine two hai, aur departure four thirty pee-em ko hai.