# Fast-Inference with Ctranslate2
Speedup inference by 2x-8x using int8 inference in C++
quantized version of Helsinki-NLP/opus-mt-en-fr
pip install hf-hub-ctranslate2>=1.0.0 ctranslate2>=3.13.0
Converted using
ct2-transformers-converter --model Helsinki-NLP/opus-mt-en-fr --output_dir /home/michael/tmp-ct2fast-opus-mt-en-fr --force --copy_files README.md generation_config.json tokenizer_config.json vocab.json source.spm .gitattributes target.spm --quantization float16
Checkpoint compatible to ctranslate2 and hf-hub-ctranslate2
compute_type=int8_float16
fordevice="cuda"
compute_type=int8
fordevice="cpu"
from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
from transformers import AutoTokenizer
model_name = "michaelfeil/ct2fast-opus-mt-en-fr"
# use either TranslatorCT2fromHfHub or GeneratorCT2fromHfHub here, depending on model.
model = TranslatorCT2fromHfHub(
# load in int8 on CUDA
model_name_or_path=model_name,
device="cuda",
compute_type="int8_float16",
tokenizer=AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-en-fr")
)
outputs = model.generate(
text=["How do you call a fast Flan-ingo?", "User: How are you doing?"],
)
print(outputs)
Licence and other remarks:
This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
Original description
opus-mt-en-fr
source languages: en
target languages: fr
OPUS readme: en-fr
dataset: opus
model: transformer-align
pre-processing: normalization + SentencePiece
download original weights: opus-2020-02-26.zip
test set translations: opus-2020-02-26.test.txt
test set scores: opus-2020-02-26.eval.txt
Benchmarks
testset | BLEU | chr-F |
---|---|---|
newsdiscussdev2015-enfr.en.fr | 33.8 | 0.602 |
newsdiscusstest2015-enfr.en.fr | 40.0 | 0.643 |
newssyscomb2009.en.fr | 29.8 | 0.584 |
news-test2008.en.fr | 27.5 | 0.554 |
newstest2009.en.fr | 29.4 | 0.577 |
newstest2010.en.fr | 32.7 | 0.596 |
newstest2011.en.fr | 34.3 | 0.611 |
newstest2012.en.fr | 31.8 | 0.592 |
newstest2013.en.fr | 33.2 | 0.589 |
Tatoeba.en.fr | 50.5 | 0.672 |
- Downloads last month
- 7
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.