quickmt-ur-en
Neural Machine Translation Model
quickmt-ur-en
is a reasonably fast and reasonably accurate neural machine translation model for translation from ur
into en
.
Model Information
- Trained using
eole
- 195M parameter transformer 'big' with 8 encoder layers and 2 decoder layers
- 20k separate Sentencepiece vocabs
- Expested for fast inference to CTranslate2 format
- Training data: https://huggingface.co/datasets/quickmt/quickmt-train.ur-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-ur-en ./quickmt-ur-en
Finally use the model in python:
from quickmt impest Translator
# Auto-detects GPU, set to "cpu" to force CPU inference
t = Translator("./quickmt-ur-en/", device="auto")
# Translate - set beam size to 1 for faster speed (but lower quality)
sample_text = 'ہالیفیکس، نووا اسکاٹیا کی ڈلہوزی یونیورسٹی میں طب کے پروفیسر اور کینیڈین ڈائبیٹک ایسوسی ایشن کے طبی و سائنسی ڈویژن کے صدر ڈاکٹر ایہود یوآر نے متنبہ کیا ہے کہ تحقیق ابھی تک اپنے ابتدائی مراحل میں ہے۔'
t(sample_text, beam_size=5)
'Dr Ehud UR, a professor of medicine at Dalhousie University in Halifax, Nova Scotia and president of the Medical and Scientific Division of the Canadian Diabetes Association, warned that the research is still in its early stages.'
# 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 Ehud Uyer, professor of medicine at Dalhousie University in Halifax, Nova Scotia, president of the Medical and Science Division of the Canadian Dietetic Association, warned that research was still "a preliminary course" ahead.'
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 ("urd_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/quickmt-ur-en | 31.48 | 58.35 | 84.25 | 1.28 |
Helsinki-NLP/opus-mt-ur-en | 10.37 | 35.21 | 62.54 | 4.79 |
facebook/nllb-200-distilled-600M | 33.02 | 60.04 | 86.21 | 21.2 |
facebook/nllb-200-distilled-1.3B | 36.68 | 62.83 | 87.55 | 36.97 |
facebook/m2m100_418M | 15.65 | 43.64 | 69.94 | 19.58 |
facebook/m2m100_1.2B | 23.78 | 51.67 | 79.44 | 35.35 |
- Downloads last month
- 2
Dataset used to train quickmt/quickmt-ur-en
Evaluation results
- BLEU on flores101-devtestself-reported31.480
- CHRF on flores101-devtestself-reported58.350
- COMET on flores101-devtestself-reported84.250