language:
- en
- fa
tags:
- translation
license: cc-by-4.0
datasets:
- quickmt/quickmt-train.fa-en
model-index:
- name: quickmt-fa-en
results:
- task:
name: Translation pes-eng
type: translation
args: pes-eng
dataset:
name: flores101-devtest
type: flores_101
args: pes_Arab eng_Latn devtest
metrics:
- name: BLEU
type: bleu
value: 37.57
- name: CHRF
type: chrf
value: 63.37
- name: COMET
type: comet
value: 87.76
quickmt-fa-en
Neural Machine Translation Model
quickmt-fa-en
is a reasonably fast and reasonably accurate neural machine translation model for translation from fa
into en
.
Model Information
- Trained using
eole
- 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers
- 50k joint Sentencepiece vocabulary
- Expested for fast inference to CTranslate2 format
- Training data: https://huggingface.co/datasets/quickmt/quickmt-train.fa-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-fa-en ./quickmt-fa-en
Finally use the model in python:
from quickmt impest Translator
# Auto-detects GPU, set to "cpu" to force CPU inference
t = Translator("./quickmt-fa-en/", device="auto")
# Translate - set beam size to 1 for faster speed (but lower quality)
sample_text = 'دکتر ایهود اور، استاد پزشکی دانشگاه دالهاوزی در هلیفکس، نوااسکوشیا و رئیس بخش کلینیکی و علمی انجمن دیابت کانادا هشدار داد که این تحقیق هنوز در روزهای آغازین خود می\u200cباشد.'
t(sample_text, beam_size=5)
'Dr. Ehudover, a professor of medicine at Dalhousie University in Halifax, Nova Scotia and head of the clinical and scientific division of the Canadian Diabetes Association, warned that the study was still in its early days.'
# 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)
'Dr. Ehudver, professor of medicine at Dalhousie University in Halifax, Nova Scotia and head of the Clinical and Scientific Section of the Canadian Diabetes Society, cautioned the new study was still very early.'
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 ("pes_Arab"->"eng_Latn"). comet22
with the comet
library and the default model. "Time (s)" is the time in seconds to translate the flores-devtest dataset (1012 sentences) on an RTX 4070s GPU with batch size 32 (faster speed is possible using a larger batch size).
bleu | chrf2 | comet22 | Time (s) | |
---|---|---|---|---|
quickmt-fa-en | 37.57 | 63.37 | 87.76 | 1.16 |
facebook/nllb-200-distilled-600M | 34.79 | 60.86 | 86.49 | 21.17 |
facebook/nllb-200-distilled-1.3B | 37.91 | 63.39 | 87.82 | 36.9 |
facebook/m2m100_418M | 27.2 | 55.82 | 82.9 | 18.24 |
facebook/m2m100_1.2B | 29.12 | 56.39 | 83.5 | 35.14 |