Views
No views yet
Qwen/Qwen2.5-0.5B to Chittagonian (চাটগাঁইয়া), a Bangla
dialect with tens of millions of speakers and almost no NLP resources.| System | ctg → bn | bn → ctg |
|---|---|---|
| base (no adaptation) | 20.54 | 19.77 |
| A1_vocab_only | 56.69 | 49.26 |
| A2_subset_cpt | 59.62 | 51.04 |
| A3_full_cpt | 59.33 | 51.98 |
| B1_subset_ctg_syl | 62.89 | 50.00 |
| B2_subset_ctg_syl_bn | 65.64 | 48.64 |
| transducer (rules+lexicon, no GPU) | — | 57.94 |
| copy input unchanged | 29.51 | — |
| Adaptation | vocab+subset_cpt |
| Dialects in CPT | ctg, syl, bn |
| CPT tokens | 8,017,920 |
| SFT loss | 1.1264 |
| Wall time | 117 min |
| Added vocabulary | 3,914 Chittagonian subword tokens |
| Precision | fp16+GradScaler (Tesla T4, sm_75 has no hardware bf16) |
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5REPO = "AsifZaman1912/ChatgaiyyaLM-0.5B-B2_subset_ctg_syl_bn"
6tok = AutoTokenizer.from_pretrained(REPO)
7model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B", dtype=torch.float16)
8model.resize_token_embeddings(len(tok)) # the adapter adds 3,914 tokens
9model = PeftModel.from_pretrained(model, REPO).eval()
10
11prompt = "চাটগাঁইয়া থেকে প্রমিত বাংলায় অনুবাদ করো:\nঅ্যাঁই ভাত ন হাইয়্যুম\nঅনুবাদ:"
12ids = tok(prompt, return_tensors="pt")
13out = model.generate(**ids, max_new_tokens=64, do_sample=False)
14print(tok.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))resize_token_embeddings before loading is required — the adapter carries a larger
embedding matrix than the base model. Always load the tokenizer from this repo:
token ids were assigned in insertion order, so a rebuilt tokenizer silently misaligns
every added token.silver (auto-derived labels or transduced
text), awaiting native-speaker validation. Do not read absolute numbers off them.