# # Fast-Inference with Ctranslate2
Speedup inference by 2x-8x using int8 inference in C++

quantized version of [Helsinki-NLP/opus-mt-de-en](https://huggingface.co/Helsinki-NLP/opus-mt-de-en)
```bash
pip install hf-hub-ctranslate2>=1.0.0 ctranslate2>=3.13.0
```
Converted using
```
ct2-transformers-converter --model Helsinki-NLP/opus-mt-de-en --output_dir /home/michael/tmp-ct2fast-opus-mt-de-en --force --copy_files README.md generation_config.json tokenizer_config.json vocab.json source.spm .gitattributes target.spm --quantization float16
```

Checkpoint compatible to [ctranslate2](https://github.com/OpenNMT/CTranslate2) and [hf-hub-ctranslate2](https://github.com/michaelfeil/hf-hub-ctranslate2)
- `compute_type=int8_float16` for `device="cuda"` 
- `compute_type=int8`  for `device="cpu"`

```python
from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
from transformers import AutoTokenizer

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

* source languages: de
* target languages: en
*  OPUS readme: [de-en](https://github.com/Helsinki-NLP/OPUS-MT-train/blob/master/models/de-en/README.md)

*  dataset: opus
* model: transformer-align
* pre-processing: normalization + SentencePiece
* download original weights: [opus-2020-02-26.zip](https://object.pouta.csc.fi/OPUS-MT-models/de-en/opus-2020-02-26.zip)
* test set translations: [opus-2020-02-26.test.txt](https://object.pouta.csc.fi/OPUS-MT-models/de-en/opus-2020-02-26.test.txt)
* test set scores: [opus-2020-02-26.eval.txt](https://object.pouta.csc.fi/OPUS-MT-models/de-en/opus-2020-02-26.eval.txt)

## Benchmarks

| testset               | BLEU  | chr-F |
|-----------------------|-------|-------|
| newssyscomb2009.de.en 	| 29.4 	| 0.557 |
| news-test2008.de.en 	| 27.8 	| 0.548 |
| newstest2009.de.en 	| 26.8 	| 0.543 |
| newstest2010.de.en 	| 30.2 	| 0.584 |
| newstest2011.de.en 	| 27.4 	| 0.556 |
| newstest2012.de.en 	| 29.1 	| 0.569 |
| newstest2013.de.en 	| 32.1 	| 0.583 |
| newstest2014-deen.de.en 	| 34.0 	| 0.600 |
| newstest2015-ende.de.en 	| 34.2 	| 0.599 |
| newstest2016-ende.de.en 	| 40.4 	| 0.649 |
| newstest2017-ende.de.en 	| 35.7 	| 0.610 |
| newstest2018-ende.de.en 	| 43.7 	| 0.667 |
| newstest2019-deen.de.en 	| 40.1 	| 0.642 |
| Tatoeba.de.en 	| 55.4 	| 0.707 |


{"license": "apache-2.0", "tags": ["ctranslate2", "translation"]}
transformers ctranslate2 translation license:apache-2.0 endpoints_compatible region:us
TAGS
#transformers #ctranslate2 #translation #license-apache-2.0 #endpoints_compatible #region-us 

# Fast-Inference with Ctranslate2
=================================


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


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


Converted using


Checkpoint compatible to ctranslate2 and hf-hub-ctranslate2


* 'compute\_type=int8\_float16' for 'device="cuda"'
* 'compute\_type=int8' for 'device="cpu"'


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-en


* source languages: de
* target languages: en
* OPUS readme: de-en
* dataset: opus
* model: transformer-align
* pre-processing: normalization + SentencePiece
* download original weights: URL
* test set translations: URL
* test set scores: URL


Benchmarks
----------


testset: URL, BLEU: 29.4, chr-F: 0.557
testset: URL, BLEU: 27.8, chr-F: 0.548
testset: URL, BLEU: 26.8, chr-F: 0.543
testset: URL, BLEU: 30.2, chr-F: 0.584
testset: URL, BLEU: 27.4, chr-F: 0.556
testset: URL, BLEU: 29.1, chr-F: 0.569
testset: URL, BLEU: 32.1, chr-F: 0.583
testset: URL, BLEU: 34.0, chr-F: 0.600
testset: URL, BLEU: 34.2, chr-F: 0.599
testset: URL, BLEU: 40.4, chr-F: 0.649
testset: URL, BLEU: 35.7, chr-F: 0.610
testset: URL, BLEU: 43.7, chr-F: 0.667
testset: URL, BLEU: 40.1, chr-F: 0.642
testset: URL, BLEU: 55.4, chr-F: 0.707



# Fast-Inference with Ctranslate2
=================================


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


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


Converted using


Checkpoint compatible to ctranslate2 and hf-hub-ctranslate2


* 'compute\_type=int8\_float16' for 'device="cuda"'
* 'compute\_type=int8' for 'device="cpu"'


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-en


* source languages: de
* target languages: en
* OPUS readme: de-en
* dataset: opus
* model: transformer-align
* pre-processing: normalization + SentencePiece
* download original weights: URL
* test set translations: URL
* test set scores: URL


Benchmarks
----------


testset: URL, BLEU: 29.4, chr-F: 0.557
testset: URL, BLEU: 27.8, chr-F: 0.548
testset: URL, BLEU: 26.8, chr-F: 0.543
testset: URL, BLEU: 30.2, chr-F: 0.584
testset: URL, BLEU: 27.4, chr-F: 0.556
testset: URL, BLEU: 29.1, chr-F: 0.569
testset: URL, BLEU: 32.1, chr-F: 0.583
testset: URL, BLEU: 34.0, chr-F: 0.600
testset: URL, BLEU: 34.2, chr-F: 0.599
testset: URL, BLEU: 40.4, chr-F: 0.649
testset: URL, BLEU: 35.7, chr-F: 0.610
testset: URL, BLEU: 43.7, chr-F: 0.667
testset: URL, BLEU: 40.1, chr-F: 0.642
testset: URL, BLEU: 55.4, chr-F: 0.707
TAGS
#transformers #ctranslate2 #translation #license-apache-2.0 #endpoints_compatible #region-us 
 # Fast-Inference with Ctranslate2
=================================


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


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


Converted using


Checkpoint compatible to ctranslate2 and hf-hub-ctranslate2


* 'compute\_type=int8\_float16' for 'device="cuda"'
* 'compute\_type=int8' for 'device="cpu"'


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-en


* source languages: de
* target languages: en
* OPUS readme: de-en
* dataset: opus
* model: transformer-align
* pre-processing: normalization + SentencePiece
* download original weights: URL
* test set translations: URL
* test set scores: URL


Benchmarks
----------


testset: URL, BLEU: 29.4, chr-F: 0.557
testset: URL, BLEU: 27.8, chr-F: 0.548
testset: URL, BLEU: 26.8, chr-F: 0.543
testset: URL, BLEU: 30.2, chr-F: 0.584
testset: URL, BLEU: 27.4, chr-F: 0.556
testset: URL, BLEU: 29.1, chr-F: 0.569
testset: URL, BLEU: 32.1, chr-F: 0.583
testset: URL, BLEU: 34.0, chr-F: 0.600
testset: URL, BLEU: 34.2, chr-F: 0.599
testset: URL, BLEU: 40.4, chr-F: 0.649
testset: URL, BLEU: 35.7, chr-F: 0.610
testset: URL, BLEU: 43.7, chr-F: 0.667
testset: URL, BLEU: 40.1, chr-F: 0.642
testset: URL, BLEU: 55.4, chr-F: 0.707