Downloads · 30 days
34
13% of all-time downloads
NM-development/madlad400-3b-mt-ce-v0
madlad400-3b-mt-ce-v0 is a translation model from NM-development. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as mit.
This model is fine-tuned version of google/madlad400-3b-mt, trained on nmd-ce-ru-171k-v0 Chechen-Russian parallel corpora combined with smoldoc.
Downloads · 30 days
34
13% of all-time downloads
All-time downloads
266
Public
Parameters
3.2B
6.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors6.4 GB · 100%
From the Hugging Face model README
This model is fine-tuned version of google/madlad400-3b-mt, trained on nmd-ce-ru-171k-v0 Chechen-Russian parallel corpora combined with smoldoc.
BLEU and chrF++ calculated on BOUQuET 💐 for this model compared to nllb-ce-rus-v0.
| Direction | madlad400-3b-mt-ce-v0 | nllb-ce-rus-v0 |
|---|---|---|
| ce2ru | BLEU: 18.48<br>chrF2++: 41.38 | BLEU: 9.59<br>chrF2++: 33.71 |
| ru2ce | BLEU: 7.53<br>chrF2++: 32.93 | BLEU: 4.12<br>chrF2++: 26.48 |
| ce2en | BLEU: 12.37<br>chrF2++: 33.26 | BLEU: 1.36<br>chrF2++: 9.29 |
| en2ce | BLEU: 5.30<br>chrF2++: 27.71 | BLEU: 2.99<br>chrF2++: 22.91 |
You may run the model in Jupyter Notebook with this code:
from transformers import T5ForConditionalGeneration, T5Tokenizer
import torch
def translate(text, model, tokenizer, tgt_lang):
model.eval()
inputs = tokenizer(f"<2{tgt_lang}> {text}", return_tensors="pt").to(device)
outputs = model.generate(
**inputs,
max_length=256,
num_beams=5,
early_stopping=True
)
return tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_id = 'NM-development/madlad400-3b-mt-ce-v0'
model = T5ForConditionalGeneration.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map=None,
).to(device)
tokenizer = T5Tokenizer.from_pretrained(model_id)
text = "После захода солнца батраки сложили сено у сарая и ушли из хутора."
translate(text, model, tokenizer, 'ce')
# Малх бухаделлачул тӀаьхьа, цӀийнан керта ялта а диллина, кӀотар чуьра дӀабахара бацараш.