Downloads · 30 days
15
12% of all-time downloads
anzorq/m2m100_1.2B_ft_ru-kbd_50K
m2m100_1.2B_ft_ru-kbd_50K is a machine learning model from anzorq. 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 mit.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
15
12% of all-time downloads
All-time downloads
121
Public
Repo size
45.9 GB
Likes
0
Public
Click a slice to open those files.
.bin6.2 GB · 100%
From the Hugging Face model README
This model is a fine-tuned version of facebook/m2m100_1.2B on the anzorq/ru-kbd dataset.
More information needed
More information needed
predict_bleu = 23.3736
predict_gen_len = 16.8114
predict_loss = 0.9729
predict_runtime = 0:03:29.00
predict_samples = 1034
predict_samples_per_second = 4.947
predict_steps_per_second = 0.211
pip install transformers sentencepiece
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_path = "anzorq/m2m100_1.2B_ft_ru-kbd_50K"
tgt_lang="zu"
tokenizer = AutoTokenizer.from_pretrained('facebook/m2m100_1.2B')
model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
model.to('cuda')
def translate(text, num_beams=4, num_return_sequences=4):
inputs = tokenizer(text, return_tensors="pt")
inputs.to('cuda')
num_return_sequences = min(num_return_sequences, num_beams)
translated_tokens = model.generate(
**inputs,
forced_bos_token_id=tokenizer.lang_code_to_id[tgt_lang],
num_beams=num_beams,
num_return_sequences=num_return_sequences
)
translations = [tokenizer.decode(translation, skip_special_tokens=True) for translation in translated_tokens]
return translations