ctranslate2 translation

# Fast-Inference with Ctranslate2

Speedup inference by 2x-8x using int8 inference in C++

quantized version of Helsinki-NLP/opus-mt-de-fr

pip install hf-hub-ctranslate2>=1.0.0 ctranslate2>=3.13.0

Converted using

ct2-transformers-converter --model Helsinki-NLP/opus-mt-de-fr --output_dir /home/michael/tmp-ct2fast-opus-mt-de-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

from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
from transformers import AutoTokenizer

model_name = "michaelfeil/ct2fast-opus-mt-de-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-de-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-de-fr

Benchmarks

testset BLEU chr-F
euelections_dev2019.transformer-align.de 32.2 0.590
newssyscomb2009.de.fr 26.8 0.553
news-test2008.de.fr 26.4 0.548
newstest2009.de.fr 25.6 0.539
newstest2010.de.fr 29.1 0.572
newstest2011.de.fr 26.9 0.551
newstest2012.de.fr 27.7 0.554
newstest2013.de.fr 29.5 0.560
newstest2019-defr.de.fr 36.6 0.625
Tatoeba.de.fr 49.2 0.664