Downloads · 30 days
28
2% of all-time downloads
zaanind/nllb-ensi-v1.6
nllb-ensi-v1.6 is a translation model from zaanind. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as cc-by-nc-4.0.
It is a NLLB-200-600M model fine-tuned for translating between englih and sinhala languages
Downloads · 30 days
28
2% of all-time downloads
All-time downloads
1.3K
Public
Repo size
24.6 GB
Likes
0
Public
Click a slice to open those files.
.bin2.5 GB · 99%
From the Hugging Face model README
It is a NLLB-200-600M model fine-tuned for translating between englih and sinhala languages
Training & Inference Codes - https://github.com/zaanind/NLLB-200-Sinhala
1.Install necessary libraries
pip install requests sentencepiece transformers==4.33 sacremoses sacrebleu
2.Translate!
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
import torch
model_name = "zaanind/nllb-ensi-v1-tuning" #download model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
def dotranslate(text): #define function for generation
inputs = tokenizer(text, return_tensors="pt")
translated_tokens = model.generate(**inputs, forced_bos_token_id=tokenizer.lang_code_to_id["sin_Sinh"])
out = tokenizer.decode(translated_tokens[0], skip_special_tokens=True)
return out
dotranslate("hello how are you?") #translate