|
--- |
|
language: |
|
- en |
|
- fr |
|
tags: |
|
- translation |
|
license: cc-by-4.0 |
|
datasets: |
|
- quickmt/quickmt-train.en-fr |
|
model-index: |
|
- name: quickmt-en-fr |
|
results: |
|
- task: |
|
name: Translation fra-eng |
|
type: translation |
|
args: fra-eng |
|
dataset: |
|
name: flores101-devtest |
|
type: flores_101 |
|
args: eng_Latn fra_Latn devtest |
|
metrics: |
|
- name: CHRF |
|
type: chrf |
|
value: 71.60 |
|
- name: BLEU |
|
type: bleu |
|
value: 50.79 |
|
- name: COMET |
|
type: comet |
|
value: 87.11 |
|
--- |
|
|
|
|
|
# `quickmt-en-fr` Neural Machine Translation Model |
|
|
|
`quickmt-en-fr` is a reasonably fast and reasonably accurate neural machine translation model for translation from `en` into `fr`. |
|
|
|
|
|
## Model Information |
|
|
|
* Trained using [`eole`](https://github.com/eole-nlp/eole) |
|
* 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers |
|
* 50k joint Sentencepiece vocabulary |
|
* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format |
|
* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.fr-en/tree/main |
|
|
|
See the `eole-config.yaml` model configuration in this repository for further details. |
|
|
|
|
|
## 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: |
|
|
|
```bash |
|
git clone https://github.com/quickmt/quickmt.git |
|
pip install ./quickmt/ |
|
|
|
# List available models |
|
quickmt-list |
|
|
|
# Download a model |
|
quickmt-model-download quickmt/quickmt-en-fr ./quickmt-en-fr |
|
``` |
|
|
|
Finally use the model in python: |
|
|
|
```python |
|
from quickmt import Translator |
|
|
|
# Auto-detects GPU, set to "cpu" to force CPU inference |
|
t = Translator("./quickmt-en-fr/", device="auto") |
|
|
|
# Translate - set beam size to 5 for higher quality (but slower speed) |
|
sample_text = "The Virgo interferometer is a large-scale scientific instrument near Pisa, Italy, for detecting gravitational waves." |
|
t(sample_text, beam_size=1) |
|
|
|
# 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) |
|
``` |
|
|
|
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](https://libretranslate.com/) which also uses `ctranslate2` and `sentencepiece`. |
|
|
|
|
|
## Metrics |
|
|
|
`bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores) ("eng_Latn"->"fra_Latn"). `comet22` with the [`comet`](https://github.com/Unbabel/COMET) library and the [default model](https://huggingface.co/Unbabel/wmt22-comet-da). "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. |
|
|
|
| Model | chrf2 | bleu | comet22 | Time (s) | |
|
| -------------------------------- | ----- | ------- | ------- | -------- | |
|
| quickmt/quickmt-en-fr | 71.60 | 50.79 | 87.11 | 1.28 | |
|
| Helsinki-NLP/opus-mt-en-fr | 69.98 | 47.97 | 86.29 | 4.13 | |
|
| facebook/m2m100_418M | 63.29 | 39.52 | 82.11 | 22.4 | |
|
| facebook/m2m100_1.2B | 68.31 | 45.39 | 86.50 | 44.0 | |
|
| facebook/nllb-200-distilled-600M | 70.36 | 48.71 | 87.63 | 27.8 | |
|
| facebook/nllb-200-distilled-1.3B | 71.95 | 51.10 | 88.50 | 47.8 | |
|
|
|
`quickmt-en-fr` is the fastest and is higher quality than `opus-mt-en-fr`, `m2m100_418m`, `m2m100_1.2B`. |
|
|