Downloads · 30 days
97
9% of all-time downloads
leks-forever/nllb-200-distilled-600M
nllb-200-distilled-600M is a translation model from leks-forever. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as apache-2.0.
This version of the No Language Left Behind (NLLB) model has been fine-tuned on a bilingual dataset of Russian and Lezgian sentences to improve translation quality in both directions (from Russian to Lezgian and from…
Downloads · 30 days
97
9% of all-time downloads
All-time downloads
1.1K
Public
Parameters
628M
12.9 GB on disk
Likes
2
Public
Click a slice to open those files.
.onnx_data5.9 GB · 46%
From the Hugging Face model README
This version of the No Language Left Behind (NLLB) model has been fine-tuned on a bilingual dataset of Russian and Lezgian sentences to improve translation quality in both directions (from Russian to Lezgian and from Lezgian to Russian). The model is designed to provide accurate and high-quality translations between these two languages.
from transformers import AutoModelForSeq2SeqLM, NllbTokenizer
model = AutoModelForSeq2SeqLM.from_pretrained("leks-forever/nllb-200-distilled-600M")
tokenizer = NllbTokenizer.from_pretrained("leks-forever/nllb-200-distilled-600M")
def predict(
text,
src_lang='lez_Cyrl',
tgt_lang='rus_Cyrl',
a=32, b=3,
max_input_length=1024,
num_beams=1,
**kwargs
):
tokenizer.src_lang = src_lang
tokenizer.tgt_lang = tgt_lang
inputs = tokenizer(text, return_tensors='pt', padding=True, truncation=True, max_length=max_input_length)
result = model.generate(
**inputs.to(model.device),
forced_bos_token_id=tokenizer.convert_tokens_to_ids(tgt_lang),
max_new_tokens=int(a + b * inputs.input_ids.shape[1]),
num_beams=num_beams,
**kwargs
)
return tokenizer.batch_decode(result, skip_special_tokens=True)
sentence: str = "Я люблю гулять по парку ранним утром, когда воздух свежий и тишина вокруг."
translation = predict(sentence, src_lang='rus_Cyrl', tgt_lang='lez_Cyrl')
print(translation)
# ['Заз пакамахъ, хъсан гар алаз, сагъ-саламатдиз къекъвез кӀанзава.'
The model was fine-tuned on the bible-lezghian-russian dataset, which contains 13,800 parallel sentences in Russian and Lezgian. The dataset was split into three parts: 90% for training, 5% for validation, and 5% for testing.
The preprocessing step included tokenization with a custom-trained SentencePiece NLLB-based tokenizer on the Russian-Lezgian corpus.
The evaluation was conducted on the val set of the bible-lezghian-russian dataset, consisting of 5% of the total 13,800 parallel sentences.
The evaluation considered translations in both directions:
The following metrics were used to evaluate the model’s performance:
These results indicate that the model can produce accurate translations for both language pairs. However, there are plans to improve the model further by conducting parallel alignment of the corpora to refine the sentence pair matching. Additionally, efforts will be made to collect more training data to enhance the model's performance, especially in handling more diverse and complex linguistic structures.
<!-- ## More Information [optional] [More Information Needed] ## Model Card Authors [optional] [More Information Needed] ## Model Card Contact [More Information Needed] -->