Downloads · 30 days
19
5% of all-time downloads
user10383/nllb-600M-finetune-en-kha
nllb-600M-finetune-en-kha is a translation model from user10383. Use it when you need text moved from one language to another. It is set up for transformers.
This is the preferred method for translating a large number of sentences when used in conjunction with a Hugging Face Dataset.
Downloads · 30 days
19
5% of all-time downloads
All-time downloads
361
Public
Parameters
615M
9.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.5 GB · 99%
From the Hugging Face model README
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_name = "ahlad/nllb-600M-finetune-en-kha"
tokenizer = AutoTokenizer.from_pretrained(model_name, src_lang="vie_Latn")
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
article = "Kata ka dei ka bos ."
inputs = tokenizer(article, return_tensors="pt")
translated_tokens = model.generate(
**inputs, forced_bos_token_id=tokenizer.convert_tokens_to_ids("eng_Latn"), max_length=30
)
print(tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0])
This is the preferred method for translating a large number of sentences when used in conjunction with a Hugging Face Dataset.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, pipeline
import torch
model_name = "ahlad/nllb-600M-finetune-en-kha"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
translator_nllb = pipeline(
"translation",
model=model,
tokenizer=tokenizer,
src_lang="vie_Latn",
tgt_lang="eng_Latn",
max_length=128,
device=0 if torch.cuda.is_available() else -1,
)