File size: 5,460 Bytes
385fd2e
 
 
2e2007c
385fd2e
 
 
 
 
2c89848
2e2007c
 
385fd2e
 
 
 
 
 
2e2007c
385fd2e
 
2a798e5
385fd2e
 
 
 
2e2007c
385fd2e
 
2e2007c
2a798e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385fd2e
 
a27927a
 
385fd2e
 
 
 
 
2e2007c
 
385fd2e
 
 
a27927a
385fd2e
 
 
 
2e2007c
 
385fd2e
 
2e2007c
 
385fd2e
 
 
 
2e2007c
385fd2e
2e2007c
385fd2e
 
 
2e2007c
385fd2e
 
2e2007c
385fd2e
 
 
6bc3911
2e2007c
 
385fd2e
 
 
 
2e2007c
385fd2e
 
2e2007c
385fd2e
 
 
 
2e2007c
385fd2e
 
2e2007c
385fd2e
 
 
 
 
 
2e2007c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2a798e5
 
 
 
 
 
 
 
 
 
 
2e2007c
385fd2e
2e2007c
385fd2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
language:
- is
- en
tags:
- translation
license: cc-by-4.0
datasets:
- quickmt/quickmt-train.is-en
- quickmt/newscrawl2024-en-backtranslated-is
- quickmt/finetranslations-sample-is-en
- HuggingFaceFW/finetranslations
model-index:
- name: quickmt-is-en
  results:
  - task:
      name: Translation isl-eng
      type: translation
      args: iso-eng
    dataset:
      name: flores101-devtest
      type: translation
      args: isl_Latn eng_Latn devtest
    metrics:
    - name: BLEU
      type: bleu
      value: 36.09
    - name: CHRF
      type: chrf
      value: 60.91
  - task:
      name: Translation isl-eng
      type: translation
      args: iso-eng
    dataset:
      name: bouquet
      type: translation
      args: isl_Latn eng_Latn test
    metrics:
    - name: BLEU
      type: bleu
      value: 47.68
    - name: CHRF
      type: chrf
      value: 65.91
---

<a href="https://huggingface.co/spaces/quickmt/quickmt-gui"><img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-lg-dark.svg" alt="Open in Spaces"></a>


# `quickmt-is-en` Neural Machine Translation Model 

`quickmt-is-en` is a reasonably fast and reasonably accurate neural machine translation model for translation from `is` into `en`.

`quickmt` models are roughly 3 times faster for GPU inference than OpusMT models and roughly [40 times](https://huggingface.co/spaces/quickmt/quickmt-vs-libretranslate) faster than [LibreTranslate](https://huggingface.co/spaces/quickmt/quickmt-vs-libretranslate)/[ArgosTranslate](github.com/argosopentech/argos-translate). 


## Try it on our Huggingface Space

Give it a try before downloading here: https://huggingface.co/spaces/quickmt/quickmt-gui


## Model Information

* Trained using [`quickmt-train`](github.com/quickmt/quickmt-train) 
* 200M parameter seq2seq transformer
* 32k separate Sentencepiece vocabs
* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format
* The pytorch model (for fine-tuning or pytorch inference) is available in this repository in the `pytorch_model` folder
  * Original configuration file: `config.yaml`


## Usage with `quickmt`

If you want to do GPU inference be sure you have the Nvidia driver and cuda toolkit installed.

Next, install the `quickmt` python library and download the model:

```bash
git clone https://github.com/quickmt/quickmt.git
pip install -e ./quickmt/
```

Finally use the model in python:

```python
from quickmt import Translator

# Auto-detects GPU, set to "cpu" to force CPU inference
mt = Translator("quickmt/quickmt-is-en", device="auto")

# Translate - set beam size to 1 for faster speed (but lower quality)
sample_text = 'Dr. Ehud Ur, læknaprófessor við Dalhousie-háskólann í Halifax í Nova Scotia og formaður klínískrar vísindadeildar Kanadíska sykursýkissambandsins, minnti á að rannsóknin væri rétt nýhafin.'

mt(sample_text, beam_size=5)
```

> "Dr. Ehud Ur, a medical professor at Dalhousie University in Halifax, Nova Scotia and chair of the Canadian Diabetes Association's clinical science department, recalled that the study had just begun."

```python
# Get alternative translations by sampling
# You can pass any cTranslate2 `translate_batch` arguments
mt([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
```

> 'Dr. Ehud Ur, a medical professor at Dalhousie University in Halifax, Nova Scotia, and chair of the Clinical Division of the Canadian Diabetes Association, reminded that the study had just begun.'

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`. A model in safetensors format to be used with `eole` is also provided.


## 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) and [Bouquet](https://huggingface.co/datasets/facebook/bouquet) `test` set.  "Time (s)" is the time in seconds to translate dataset on an RTX 4070s GPU with batch size 32. LLM inference done with vLLM and 32 threads. 

Benchmarks are hard to get right and make fair. Download this model and give it a try and see if it works well for you!

### flores devtest


| model                            | time  | bleu  | chrf  |
|----------------------------------|-------|-------|-------|
| quickmt-is-en                    | 1.16  | 36.09 | 60.91 |
| Helsinki-NLP/opus-mt-is-en       | 2.33  | 25.26 | 51.44 |
| facebook/nllb-200-distilled-1.3B | 18.17 | 32.79 | 56.81 |
| CohereLabs/tiny-aya-global       | 27.03 | 16.03 | 40.63 |
| google/gemma-4-E2B-it            | 46.60 | 28.55 | 54.30 |


### bouquet test

| model                            | time  | bleu  | chrf  |
|----------------------------------|-------|-------|-------|
| quickmt-is-en                    | 0.70  | 47.68 | 65.91 |
| Helsinki-NLP/opus-mt-is-en       | 1.17  | 36.46 | 56.62 |
| facebook/nllb-200-distilled-1.3B | 8.57  | 40.31 | 60.39 |
| CohereLabs/tiny-aya-global       | 14.22 | 22.26 | 43.01 |
| google/gemma-4-E2B-it            | 23.79 | 36.90 | 57.52 |


Prompt for LLM translation:

> Translate the following into {tgt_lang}, without commentary or explanation.\n\n{x}