Translation
Transformers
Safetensors
Nepali
English
IndicTrans
text2text-generation
nepali
english
indictrans2
custom_code
Instructions to use mostwise/nep-eng-indictrans2-v3-address with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mostwise/nep-eng-indictrans2-v3-address with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="mostwise/nep-eng-indictrans2-v3-address", trust_remote_code=True)# Load model directly from transformers import AutoModelForSeq2SeqLM model = AutoModelForSeq2SeqLM.from_pretrained("mostwise/nep-eng-indictrans2-v3-address", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Nepali → English (nep-eng-lora-v3-address)
Full merged fine-tune of ai4bharat/indictrans2-indic-en-dist-200M for domain Nepali→English translation (agri, finance, entity, address + BPCC replay).
LoRA (r=16, α=32) merged into base weights. Same file layout as the ai4bharat IndicTrans2 hub models.
Metrics (checkpoint step 6400)
| Metric | Value |
|---|---|
| Dev BLEU | 58.33 |
| Probe pass rate | 23/26 (0.8846) |
Training
| Setting | Value |
|---|---|
| Base model | ai4bharat/indictrans2-indic-en-dist-200M |
| Direction | npi_Deva → eng_Latn |
| LoRA rank / alpha | 16 / 32 |
| Learning rate | 0.0002 |
Usage
Load directly like any IndicTrans2 model:
import torch
from IndicTransToolkit import IndicProcessor
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_id = "mostwise/nep-eng-indictrans2-v3-address"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForSeq2SeqLM.from_pretrained(
model_id, trust_remote_code=True, attn_implementation="eager"
)
model.eval().to("cuda" if torch.cuda.is_available() else "cpu")
processor = IndicProcessor(inference=True)
src, tgt = "npi_Deva", "eng_Latn"
def translate(text: str) -> str:
batch = processor.preprocess_batch([text], src_lang=src, tgt_lang=tgt, is_target=False)
inputs = tokenizer(batch, return_tensors="pt", truncation=True, max_length=256).to(model.device)
with torch.no_grad():
out = model.generate(**inputs, max_length=256, num_beams=5, early_stopping=True, use_cache=False)
return processor.postprocess_batch(
tokenizer.batch_decode(out, skip_special_tokens=True), lang=tgt
)[0]
print(translate("स्याङ्जा जिल्लामा विद्युत् आपूर्ति सुधारका लागि नम्बर के हो?"))
Limitations
Known residual failures on geo proper nouns (Dhanusha/Sakhuwa, Mirchaiya) and some colloquial phrasing.
- Downloads last month
- 70