# Fast-Inference with Ctranslate2
Speedup inference by 2x-8x using int8 inference in C++
quantized version of Helsinki-NLP/opus-mt-es-en
pip install hf-hub-ctranslate2>=1.0.0 ctranslate2>=3.13.0
Converted using
ct2-transformers-converter --model Helsinki-NLP/opus-mt-es-en --output_dir /home/michael/tmp-ct2fast-opus-mt-es-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 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-es-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-es-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
spa-eng
source group: Spanish
target group: English
OPUS readme: spa-eng
model: transformer
source language(s): spa
target language(s): eng
model: transformer
pre-processing: normalization + SentencePiece (spm32k,spm32k)
download original weights: opus-2020-08-18.zip
test set translations: opus-2020-08-18.test.txt
test set scores: opus-2020-08-18.eval.txt
Benchmarks
testset | BLEU | chr-F |
---|---|---|
newssyscomb2009-spaeng.spa.eng | 30.6 | 0.570 |
news-test2008-spaeng.spa.eng | 27.9 | 0.553 |
newstest2009-spaeng.spa.eng | 30.4 | 0.572 |
newstest2010-spaeng.spa.eng | 36.1 | 0.614 |
newstest2011-spaeng.spa.eng | 34.2 | 0.599 |
newstest2012-spaeng.spa.eng | 37.9 | 0.624 |
newstest2013-spaeng.spa.eng | 35.3 | 0.609 |
Tatoeba-test.spa.eng | 59.6 | 0.739 |
System Info:
hf_name: spa-eng
source_languages: spa
target_languages: eng
opus_readme_url: https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/models/spa-eng/README.md
original_repo: Tatoeba-Challenge
tags:
ctranslate2 ['translation']
languages: ['es', 'en']
src_constituents: {'spa'}
tgt_constituents: {'eng'}
src_multilingual: False
tgt_multilingual: False
prepro: normalization + SentencePiece (spm32k,spm32k)
url_model: https://object.pouta.csc.fi/Tatoeba-MT-models/spa-eng/opus-2020-08-18.zip
url_test_set: https://object.pouta.csc.fi/Tatoeba-MT-models/spa-eng/opus-2020-08-18.test.txt
src_alpha3: spa
tgt_alpha3: eng
short_pair: es-en
chrF2_score: 0.7390000000000001
bleu: 59.6
brevity_penalty: 0.9740000000000001
ref_len: 79376.0
src_name: Spanish
tgt_name: English
train_date: 2020-08-18 00:00:00
src_alpha2: es
tgt_alpha2: en
prefer_old: False
long_pair: spa-eng
helsinki_git_sha: d2f0910c89026c34a44e331e785dec1e0faa7b82
transformers_git_sha: f7af09b4524b784d67ae8526f0e2fcc6f5ed0de9
port_machine: brutasse
port_time: 2020-08-24-18:20
- Downloads last month
- 41