Views
No views yet
kas_Arab).kas_Arab portion of the BPCC parallel corpus, merged back into the base weights.ai4bharat/indictrans2-en-indic-dist-200Meng_Latn)kas_Arab)IndicTransToolkit for the pre/post-processing IndicTrans2 expects (language tags, script normalization).1pip install transformers accelerate sentencepiece
2git clone https://github.com/VarunGumma/IndicTransToolkit.git
3pip install --editable ./IndicTransToolkit1import torch
2from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
3from IndicTransToolkit.IndicTransToolkit import IndicProcessor
4
5MODEL_ID = "bazik-0/indictrans2-en-kas-finetuned-200M-5"
6
7tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
8model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_ID, trust_remote_code=True, torch_dtype=torch.float32)
9model.eval()
10
11ip = IndicProcessor(inference=True)
12
13sentences = ["Hello, how are you?", "The weather is very cold today."]
14processed = ip.preprocess_batch(sentences, src_lang="eng_Latn", tgt_lang="kas_Arab")
15
16inputs = tokenizer(processed, return_tensors="pt", padding=True, truncation=True, max_length=128)
17
18with torch.no_grad():
19 outputs = model.generate(**inputs, max_length=128, num_beams=5, early_stopping=True)
20
21decoded = tokenizer.batch_decode(outputs, skip_special_tokens=True)
22translations = ip.postprocess_batch(decoded, lang="kas_Arab")
23
24print(translations)| English | Kashmiri |
|---|---|
| She was a true visionary. | سہٕ ٲس اکھ حقیقی نظریہ ساز۔ |
| I go to my school daily. | بہٕ چھس پرٛؠتھ دۄہ پننس سکولس منٛز گژھان۔ |
| Nobody know whence he has come. | کٲنہہ تہ چھنہٕ زانان سہ کتہ پؠٹھ چھ آمت۔ |
ai4bharat/BPCC (bpcc-seed-latest config), kas_Arab subset — 90,000 training pairs and 8,929 held-out eval pairs, shuffled with seed 42.IndicTransToolkit's IndicProcessor for IndicTrans2's language-tag formatting and script normalization before tokenization. Sequences are truncated to a max length of 128 tokens.r=16, alpha=32, dropout 0.05q_proj, v_proj| Param | Value |
|---|---|
| Epochs | 8 |
| Per-device batch size | 16 |
| Gradient accumulation | 8 (effective batch 128) |
| Learning rate | 5e-5 |
| Weight decay | 0.01 |
| Warmup ratio | 0.03 |
| Precision | bf16 |
| Optimizer | AdamW |
| Max grad norm | 1.0 |
Seq2SeqTrainer.sacrebleu), computed on the held-out eval split.kas_Arab (Perso-Arabic script); it does not support Kashmiri written in Devanagari.1@article{gala2023indictrans2,
2 title = {IndicTrans2: Towards High-Quality and Accessible Machine Translation Models for all 22 Scheduled Indian Languages},
3 author = {Jay Gala and Pranjal A. Chitale and A K Raghavan and Varun Gumma and Sumanth Doddapaneni and Aswanth Kumar M and Janki Atul Nawale and Anupama Sujatha and Ratish Puduppully and Vivek Raghavan and Pratyush Kumar and Mitesh M. Khapra and Raj Dabre and Anoop Kunchukuttan},
4 journal = {arXiv preprint arXiv:2305.16307},
5 year = {2023}
6}