Downloads · 30 days
107
45% of all-time downloads
Prukario/opus-mt-es-en-ct2-int8
opus-mt-es-en-ct2-int8 is a translation model from Prukario. 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-4.0.
CTranslate2 INT8-quantized conversion of Helsinki-NLP/opus-mt-es-en, the OPUS-MT Spanish→English machine translation model.
Downloads · 30 days
107
45% of all-time downloads
All-time downloads
239
Public
Repo size
81.2 MB
Likes
0
Public
Click a slice to open those files.
.bin79.6 MB · 96%
From the Hugging Face model README
CTranslate2 INT8-quantized conversion of Helsinki-NLP/opus-mt-es-en, the OPUS-MT Spanish→English machine translation model.
Used by PruGlobal as the local MT backend for the Free tier: runs entirely on the user's CPU with no cloud calls, so we can offer a baseline translation experience without consuming EVOR credits.
ctranslate2 + sentencepiece are neededimport ctranslate2
import sentencepiece as spm
from huggingface_hub import snapshot_download
path = snapshot_download("Prukario/opus-mt-es-en-ct2-int8")
translator = ctranslate2.Translator(path, device="cpu", compute_type="int8")
sp_src = spm.SentencePieceProcessor(model_file=f"{path}/source.spm")
sp_tgt = spm.SentencePieceProcessor(model_file=f"{path}/target.spm")
def translate(text: str) -> str:
tokens = sp_src.encode(text, out_type=str) + ["</s>"] # Marian needs EOS
out = translator.translate_batch([tokens], beam_size=2)[0].hypotheses[0]
if "</s>" in out:
out = out[: out.index("</s>")]
return sp_tgt.decode(out)
print(translate("Hola, ¿cómo estás?"))
# -> "Hello, how are you?"
pip install torch transformers ctranslate2 sentencepiece
ct2-transformers-converter \
--model Helsinki-NLP/opus-mt-es-en \
--output_dir opus-mt-es-en-ct2-int8 \
--quantization int8 \
--copy_files source.spm target.spm tokenizer_config.json
If you use this model, please cite the original OPUS-MT paper:
@inproceedings{TiedemannThottingal:EAMT2020,
author = {J{\"o}rg Tiedemann and Santhosh Thottingal},
title = {{OPUS-MT} — {B}uilding open translation services for the {W}orld},
booktitle = {Proceedings of the 22nd Annual Conference of the European Association for Machine Translation (EAMT)},
year = {2020},
address = {Lisbon, Portugal}
}
CC-BY 4.0, inherited from the Helsinki-NLP/opus-mt-es-en base model.