Downloads · 30 days
10
21% of all-time downloads
kariiiiiimu/nllb
nllb is a machine learning model from kariiiiiimu. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is a fine-tuned version of facebook/nllb-200-distilled-600M for English-to-Kimochi translation.
Downloads · 30 days
10
21% of all-time downloads
All-time downloads
48
Public
Parameters
615M
5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.5 GB · 99%
From the Hugging Face model README
This model is a fine-tuned version of facebook/nllb-200-distilled-600M for English-to-Kimochi translation.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("kariiiiiimu/nllb")
model = AutoModelForSeq2SeqLM.from_pretrained("kariiiiiimu/nllb")
# Set source language
tokenizer.src_lang = "eng_Latn"
# Translate
text = "Hello, how are you?"
inputs = tokenizer(text, return_tensors="pt")
# Get target language ID safely
target_lang_id = None
for attr in ['lang_code_to_id', 'lang_code_to_token_id']:
if hasattr(tokenizer, attr):
lang_mapping = getattr(tokenizer, attr)
if "kom_Latn" in lang_mapping:
target_lang_id = lang_mapping["kom_Latn"]
break
if target_lang_id:
outputs = model.generate(**inputs, forced_bos_token_id=target_lang_id)
else:
outputs = model.generate(**inputs)
translation = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(translation)