language:
- en
- es
tags:
- translation
license: cc-by-4.0
datasets:
- quickmt/quickmt-train.es-en
model-index:
- name: quickmt-en-es
results:
- task:
name: Translation eng-spa
type: translation
args: eng-spa
dataset:
name: flores101-devtest
type: flores_101
args: eng_Latn spa_Latn devtest
metrics:
- name: BLEU
type: bleu
value: 26.64
- name: CHRF
type: chrf
value: 55.12
- name: COMET
type: comet
value: 85.15
quickmt-en-es
Neural Machine Translation Model
quickmt-en-es
is a reasonably fast and reasonably accurate neural machine translation model for translation from en
into es
.
Model Information
- Trained using
eole
- 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers
- 20k sentencepiece vocabularies
- Exported for fast inference to CTranslate2 format
- Training data: https://huggingface.co/datasets/quickmt/quickmt-train.it-en/tree/main
See the eole
model configuration in this repository for further details and the eole-model
for the raw eole
(pytorch) model.
Usage with quickmt
You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
Next, install the quickmt
python library and download the model:
git clone https://github.com/quickmt/quickmt.git
pip install ./quickmt/
quickmt-model-download quickmt/quickmt-en-es ./quickmt-en-es
Finally use the model in python:
from quickmt import Translator
# Auto-detects GPU, set to "cpu" to force CPU inference
t = Translator("./quickmt-en-es/", device="auto")
# Translate - set beam size to 5 for higher quality (but slower speed)
sample_text = 'Dr. Ehud Ur, professor of medicine at Dalhousie University in Halifax, Nova Scotia and chair of the clinical and scientific division of the Canadian Diabetes Association cautioned that the research is still in its early days.'
t(sample_text, beam_size=5)
> 'El Dr. Ehud Ur, profesor de medicina de la Universidad de Dalhousie en Halifax, Nueva Escocia y presidente de la divisi贸n cl铆nica y cient铆fica de la Asociaci贸n Canadiense de Diabetes, advirti贸 que la investigaci贸n todav铆a est谩 en sus primeros d铆as.'
# Get alternative translations by sampling
# You can pass any cTranslate2 `translate_batch` arguments
t([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
> 'El Dr. Ehud Ur, profesor de medicina en la Universidad de Dalhousie en Halifax (Nova Escocia), y presidenta de la divisi贸n cl铆nica y cient铆fica de la Asociaci贸n Canadiense de Diabetes, advirti贸 que la investigaci贸n contin煤a en sus d铆as iniciales.'
The model is in ctranslate2
format, and the tokenizers are sentencepiece
, so you can use ctranslate2
directly instead of through quickmt
. It is also possible to get this model to work with e.g. LibreTranslate which also uses ctranslate2
and sentencepiece
.
Metrics
bleu
and chrf2
are calculated with sacrebleu on the Flores200 devtest
test set ("eng_Latn"->"spa_Latn"). comet22
with the comet
library and the default model. "Time (s)" is the time in seconds to translate (using ctranslate2
) the flores-devtest dataset (1012 sentences) on an RTX 4070s GPU with batch size 32 (faster speed is possible using a large batch size).
bleu | chrf2 | comet22 | Time (s) | |
---|---|---|---|---|
quickmt/quickmt-en-es | 26.64 | 55.12 | 85.15 | 1.41 |
Helsink-NLP/opus-mt-en-es | 26.56 | 55.01 | 84.92 | 3.79 |
facebook/nllb-200-distilled-600M | 27.2 | 55.68 | 85.82 | 24.12 |
facebook/nllb-200-distilled-1.3B | 28.06 | 56.47 | 86.55 | 42.12 |
facebook/m2m100_418M | 22.48 | 51.72 | 81.05 | 19.65 |
facebook/m2m100_1.2B | 25.75 | 54.38 | 84.58 | 38.47 |