Downloads · 30 days
38
16% of all-time downloads
pulkitchowdry/nllb-600m-ct2-int8
nllb-600m-ct2-int8 is a translation model from pulkitchowdry. Use it when you need text moved from one language to another. It is set up for ctranslate2. The card lists the license as cc-by-nc-4.0.
This repository contains the Facebook NLLB-200 Distilled 600M model converted to the CTranslate2 format using INT8 quantization.
Downloads · 30 days
38
16% of all-time downloads
All-time downloads
245
Public
Repo size
655 MB
Likes
1
Public
Click a slice to open those files.
.bin623 MB · 94%
From the Hugging Face model README
This repository contains the Facebook NLLB-200 Distilled 600M model converted to the CTranslate2 format using INT8 quantization.
ct2-transformers-converter \
--model facebook/nllb-200-distilled-600M \
--output_dir nllb-600m-ct2 \
--quantization int8
import ctranslate2
from transformers import AutoTokenizer
from huggingface_hub import snapshot_download
REPO_ID = "pulkitchowdry/nllb-600m-ct2-int8"
# Download model from Hugging Face
model_dir = snapshot_download(repo_id=REPO_ID)
print("Model downloaded to:", model_dir)
# Load translator
translator = ctranslate2.Translator(
model_dir,
device="cpu"
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_dir, fix_mistral_regex=True)
src_lang = "eng_Latn"
tgt_lang = "fra_Latn"
text = "Hello, how are you today?"
tokenizer.src_lang = src_lang
# Tokenize
input_ids = tokenizer(text).input_ids
tokens = tokenizer.convert_ids_to_tokens(input_ids)
# Translate
results = translator.translate_batch(
[tokens],
target_prefix=[[tgt_lang]]
)
output_tokens = results[0].hypotheses[0]
translation = tokenizer.decode(
tokenizer.convert_tokens_to_ids(output_tokens),
skip_special_tokens=True,
)
print("Input:", text)
print("Translation:", translation)