Downloads · 30 days
17
10% of all-time downloads
lab-ii/mt5-yakut
mt5-yakut is a machine learning model from lab-ii. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
"translate Russian to Sakha: " - Ru-sah "translate Sakha to Russian: " - sah-Ru
Downloads · 30 days
17
10% of all-time downloads
All-time downloads
174
Public
Parameters
601M
2.4 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors2.4 GB · 99%
From the Hugging Face model README
"translate Russian to Sakha: " - Ru-sah
"translate Sakha to Russian: " - sah-Ru
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model = AutoModelForSeq2SeqLM.from_pretrained("lab-ii/mt5-yakut")
tokenizer = AutoTokenizer.from_pretrained("lab-ii/mt5-yakut")
def predict(text, prefix, a=32, b=3, max_input_length=1024, num_beams=3, **kwargs):
inputs = tokenizer(prefix + text, return_tensors='pt', padding=True, truncation=True, max_length=max_input_length)
result = model.generate(
**inputs.to(model.device),
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, prefix="translate Russian to Sakha: ")
print(translation)
# ['Бэрэограф ааспыт фесттан хаартыскалары ыытан көрдөрбүт.']