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

quantized version of [Helsinki-NLP/opus-mt-fr-de](https://huggingface.co/Helsinki-NLP/opus-mt-fr-de)
```bash
pip install hf-hub-ctranslate2>=1.0.0 ctranslate2>=3.13.0
```
Converted using
```
ct2-transformers-converter --model Helsinki-NLP/opus-mt-fr-de --output_dir /home/michael/tmp-ct2fast-opus-mt-fr-de --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-fr-de"
# 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-fr-de")
)
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-fr-de

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

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

## Benchmarks

| testset               | BLEU  | chr-F |
|-----------------------|-------|-------|
| euelections_dev2019.transformer-align.fr 	| 26.4 	| 0.571 |
| newssyscomb2009.fr.de 	| 22.1 	| 0.524 |
| news-test2008.fr.de 	| 22.1 	| 0.524 |
| newstest2009.fr.de 	| 21.6 	| 0.520 |
| newstest2010.fr.de 	| 22.6 	| 0.527 |
| newstest2011.fr.de 	| 21.5 	| 0.518 |
| newstest2012.fr.de 	| 22.4 	| 0.516 |
| newstest2013.fr.de 	| 24.2 	| 0.532 |
| newstest2019-frde.fr.de 	| 27.9 	| 0.595 |
| Tatoeba.fr.de 	| 49.1 	| 0.676 |


{"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-fr-de


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-fr-de


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


Benchmarks
----------


testset: euelections\_dev2019.URL, BLEU: 26.4, chr-F: 0.571
testset: URL, BLEU: 22.1, chr-F: 0.524
testset: URL, BLEU: 22.1, chr-F: 0.524
testset: URL, BLEU: 21.6, chr-F: 0.520
testset: URL, BLEU: 22.6, chr-F: 0.527
testset: URL, BLEU: 21.5, chr-F: 0.518
testset: URL, BLEU: 22.4, chr-F: 0.516
testset: URL, BLEU: 24.2, chr-F: 0.532
testset: URL, BLEU: 27.9, chr-F: 0.595
testset: URL, BLEU: 49.1, chr-F: 0.676



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


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


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


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-fr-de


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


Benchmarks
----------


testset: euelections\_dev2019.URL, BLEU: 26.4, chr-F: 0.571
testset: URL, BLEU: 22.1, chr-F: 0.524
testset: URL, BLEU: 22.1, chr-F: 0.524
testset: URL, BLEU: 21.6, chr-F: 0.520
testset: URL, BLEU: 22.6, chr-F: 0.527
testset: URL, BLEU: 21.5, chr-F: 0.518
testset: URL, BLEU: 22.4, chr-F: 0.516
testset: URL, BLEU: 24.2, chr-F: 0.532
testset: URL, BLEU: 27.9, chr-F: 0.595
testset: URL, BLEU: 49.1, chr-F: 0.676
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-fr-de


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-fr-de


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


Benchmarks
----------


testset: euelections\_dev2019.URL, BLEU: 26.4, chr-F: 0.571
testset: URL, BLEU: 22.1, chr-F: 0.524
testset: URL, BLEU: 22.1, chr-F: 0.524
testset: URL, BLEU: 21.6, chr-F: 0.520
testset: URL, BLEU: 22.6, chr-F: 0.527
testset: URL, BLEU: 21.5, chr-F: 0.518
testset: URL, BLEU: 22.4, chr-F: 0.516
testset: URL, BLEU: 24.2, chr-F: 0.532
testset: URL, BLEU: 27.9, chr-F: 0.595
testset: URL, BLEU: 49.1, chr-F: 0.676