đ Fast-Inference with Ctranslate2
This project uses int8 inference in C++ to speed up inference by 2x - 8x. It's a quantized version of Helsinki-NLP/opus-mt-ROMANCE-en, aiming to provide a more efficient solution for translation tasks.
đ Quick Start
đĻ Installation
Install the necessary packages using the following command:
pip install hf-hub-ctranslate2>=1.0.0 ctranslate2>=3.13.0
Convert the model using the following command:
ct2-transformers-converter --model Helsinki-NLP/opus-mt-ROMANCE-en --output_dir /home/michael/tmp-ct2fast-opus-mt-ROMANCE-en --force --copy_files README.md generation_config.json tokenizer_config.json vocab.json source.spm .gitattributes target.spm --quantization float16
đģ Usage Examples
Basic Usage
from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
from transformers import AutoTokenizer
model_name = "michaelfeil/ct2fast-opus-mt-ROMANCE-en"
model = TranslatorCT2fromHfHub(
model_name_or_path=model_name,
device="cuda",
compute_type="int8_float16",
tokenizer=AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-ROMANCE-en")
)
outputs = model.generate(
text=["How do you call a fast Flan-ingo?", "User: How are you doing?"],
)
print(outputs)
đ§ Technical Details
The checkpoint is compatible with ctranslate2 and hf-hub-ctranslate2.
- Use
compute_type=int8_float16
for device="cuda"
- Use
compute_type=int8
for device="cpu"
đ License
This is just a quantized version. Licence conditions are intended to be identical to the original huggingface repo.
đ Documentation
Original description
opus-mt-ROMANCE-en
Property |
Details |
Source Languages |
fr,fr_BE,fr_CA,fr_FR,wa,frp,oc,ca,rm,lld,fur,lij,lmo,es,es_AR,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,es_MX,es_NI,es_PA,es_PE,es_PR,es_SV,es_UY,es_VE,pt,pt_br,pt_BR,pt_PT,gl,lad,an,mwl,it,it_IT,co,nap,scn,vec,sc,ro,la |
Target Languages |
en |
OPUS readme |
fr+fr_BE+fr_CA+fr_FR+wa+frp+oc+ca+rm+lld+fur+lij+lmo+es+es_AR+es_CL+es_CO+es_CR+es_DO+es_EC+es_ES+es_GT+es_HN+es_MX+es_NI+es_PA+es_PE+es_PR+es_SV+es_UY+es_VE+pt+pt_br+pt_BR+pt_PT+gl+lad+an+mwl+it+it_IT+co+nap+scn+vec+sc+ro+la-en |
Dataset |
opus |
Model |
transformer |
Pre - processing |
normalization + SentencePiece |
Download original weights |
opus-2020-04-01.zip |
Test set translations |
opus-2020-04-01.test.txt |
Test set scores |
opus-2020-04-01.eval.txt |
Benchmarks
testset |
BLEU |
chr-F |
Tatoeba.fr.en |
62.2 |
0.750 |