Translation
Safetensors
Ukrainian
English
Eval Results (legacy)
radinplaid commited on
Commit
5406dfa
·
verified ·
1 Parent(s): 5b5af6f

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - uk
4
+ - en
5
+ tags:
6
+ - translation
7
+ license: cc-by-4.0
8
+ datasets:
9
+ - quickmt/quickmt-train.uk-en
10
+ - quickmt/finetranslations-sample-uk-en
11
+ - HuggingFaceFW/finetranslations
12
+ model-index:
13
+ - name: quickmt-en-uk
14
+ results:
15
+ - task:
16
+ name: Translation eng-ukr
17
+ type: translation
18
+ args: eng-ukr
19
+ dataset:
20
+ name: flores101-devtest
21
+ type: flores_101
22
+ args: eng_Latn ukr_Cyrl devtest
23
+ metrics:
24
+ - name: BLEU
25
+ type: bleu
26
+ value: 32.44
27
+ - name: CHRF
28
+ type: chrf
29
+ value: 60.52
30
+
31
+ ---
32
+
33
+
34
+ # `quickmt-en-uk` Neural Machine Translation Model
35
+
36
+ `quickmt-en-uk` is a reasonably fast and reasonably accurate neural machine translation model for translation from English into Ukranian.
37
+
38
+ `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).
39
+
40
+
41
+ ## Try it on our Huggingface Space
42
+
43
+ Give it a try before downloading here: https://huggingface.co/spaces/quickmt/QuickMT-Demo
44
+
45
+
46
+ ## Model Information
47
+
48
+ * Trained using [`quickmt-train`](github.com/quickmt/quickmt-train)
49
+ * 200M parameter seq2seq transformer
50
+ * 32k separate Sentencepiece vocabs
51
+ * Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format
52
+ * The pytorch model (for fine-tuning or pytorch inference) is available in this repository in the `pytorch_model` folder
53
+ * Training config file here: `pytorch_model/config.yaml`
54
+
55
+
56
+ ## Usage with `quickmt`
57
+
58
+ You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
59
+
60
+ Next, install the `quickmt` python library and download the model:
61
+
62
+ ```bash
63
+ git clone https://github.com/quickmt/quickmt.git
64
+ pip install -e ./quickmt/
65
+ ```
66
+
67
+ Finally use the model in python:
68
+
69
+ ```python
70
+ from quickmt import Translator
71
+
72
+ # Auto-detects GPU, set to "cpu" to force CPU inference
73
+ mt = Translator("quickmt/quickmt-en-uk", device="auto")
74
+
75
+ # Translate - set beam size to 1 for faster speed (but lower quality)
76
+ 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.'
77
+
78
+ mt(sample_text, beam_size=5)
79
+ ```
80
+
81
+ > 'Доктор Ехуд Ур, професор медицини в Університеті Далхаузі в Галіфаксі, Нова Шотландія і голова клінічного та наукового відділу Канадської діабетичної асоціації, попередив, що дослідження все ще знаходиться на початку.'
82
+
83
+ ```python
84
+ # Get alternative translations by sampling
85
+ # You can pass any cTranslate2 `translate_batch` arguments
86
+ mt([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
87
+ ```
88
+
89
+ > 'Доктор Ехуд Ур (Ehud Ur), професор медицини Університету Дальсаузі в Галіфаксі (Канада), а також голова клінічної та наукового підрозділу Канадської асоціації діабету, попередив, що дослідження все ще знаходяться на стадії свого початку.'
90
+
91
+ 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 `quickmt-train` is also provided.
92
+
93
+
94
+ ## Metrics
95
+
96
+ `bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores). "Time (s)" is the time in seconds to translate the flores-devtest dataset (1012 sentences) on an RTX 4070s GPU with batch size 32.
97
+
98
+ | model | time | bleu | chrf |
99
+ |------------------------------------|-------|-------|-------|
100
+ | quickmt/quickmt-en-uk | 1.20 | 32.44 | 60.52 |
101
+ | Helsinki-NLP/opus-mt-tc-big-en-zle | 3.78 | 31.98 | 60.08 |
102
+ | facebook/nllb-200-distilled-1.3B | 19.23 | 26.31 | 56.91 |
103
+ | CohereLabs/tiny-aya-global | 35.37 | 27.45 | 56.22 |
104
+ | google/gemma-4-E2B-it | 70.78 | 29.02 | 57.54 |
config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_source_bos": true,
3
+ "add_source_eos": false,
4
+ "bos_token": "<s>",
5
+ "decoder_start_token": "<s>",
6
+ "eos_token": "</s>",
7
+ "layer_norm_epsilon": null,
8
+ "multi_query_attention": false,
9
+ "unk_token": "<unk>"
10
+ }
model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb2733a7d715e4747e3ee8ca04098ce3d9d03272e686357ab7a0d9fea6ac09cc
3
+ size 202004997
pytorch_model/averaged_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a0866e55a904d95ba7cc289e4c1a5ba06eaa9b38ae9823953b4fe9dc5b09f70
3
+ size 799828424
pytorch_model/config.yaml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ model:
2
+ d_model: 768
3
+ enc_layers: 12
4
+ dec_layers: 2
5
+ n_heads: 16
6
+ ffn_dim: 4096
7
+ max_len: 256
8
+ vocab_size_src: 32000
9
+ vocab_size_tgt: 32000
10
+ dropout: 0.05
11
+ mlp_type: "standard" # standard or gated
12
+ activation: "gelu" # gelu or silu
13
+ norm_type: "layernorm" # layernorm or rmsnorm
14
+ ff_bias: true
15
+ tie_decoder_embeddings: false
16
+ layernorm_eps: 1.0e-5
17
+
18
+ data:
19
+ src_lang: "uk"
20
+ tgt_lang: "en"
21
+ src_dev_path: "../../mt/uk-en/dev.eng"
22
+ tgt_dev_path: "../../mt/uk-en/dev.ukr"
23
+ max_tokens_per_batch: 6000
24
+ src_spm_nbest_size: -1
25
+ src_spm_alpha: 0.5
26
+ tgt_spm_nbest_size: 1
27
+ tgt_spm_alpha: 1.0
28
+ corpora:
29
+ - src_file: "../../mt/uk-en/train.cleaned.filtered.eng"
30
+ tgt_file: "../../mt/uk-en/train.cleaned.filtered.ukr"
31
+ weight: 1
32
+ start_step: 1000
33
+ - src_file: "../../mt/uk-en/finetranslations.ukr_Cyrl-eng_Latn.eng_Latn"
34
+ tgt_file: "../../mt/uk-en/finetranslations.ukr_Cyrl-eng_Latn.ukr_Cyrl"
35
+ weight: 1
36
+ start_step: 0
37
+ stop_step: 80000
38
+
39
+ train:
40
+ experiment_name: "enuk-base"
41
+ aim_repo: "~/mt/.aim"
42
+ lr: 2.5e-3
43
+ grad_clip: 0.5
44
+ accum_steps: 20
45
+ max_checkpoints: 10
46
+ precision: "bfloat16"
47
+ warmup_steps: 5000
48
+ max_steps: 200000
49
+ eval_steps: 1000
50
+
51
+ export:
52
+ k: 5
pytorch_model/tokenizer_src.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4a711986816af3b2072bc648ce419a3c9aa7b466e241539732ea7ed7c23a335
3
+ size 804561
pytorch_model/tokenizer_src.vocab ADDED
The diff for this file is too large to render. See raw diff
 
pytorch_model/tokenizer_tgt.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1135e847f628b43e825ab0c64b11989bb51636c3d16e079c17ccbdfdc3619d55
3
+ size 1014232
pytorch_model/tokenizer_tgt.vocab ADDED
The diff for this file is too large to render. See raw diff
 
quickmt-config.yaml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ model:
2
+ d_model: 768
3
+ enc_layers: 12
4
+ dec_layers: 2
5
+ n_heads: 16
6
+ ffn_dim: 4096
7
+ max_len: 256
8
+ vocab_size_src: 32000
9
+ vocab_size_tgt: 32000
10
+ dropout: 0.05
11
+ mlp_type: "standard" # standard or gated
12
+ activation: "gelu" # gelu or silu
13
+ norm_type: "layernorm" # layernorm or rmsnorm
14
+ ff_bias: true
15
+ tie_decoder_embeddings: false
16
+ layernorm_eps: 1.0e-5
17
+
18
+ data:
19
+ src_lang: "uk"
20
+ tgt_lang: "en"
21
+ src_dev_path: "dev.eng"
22
+ tgt_dev_path: "dev.ukr"
23
+ max_tokens_per_batch: 6000
24
+ src_spm_nbest_size: -1
25
+ src_spm_alpha: 0.5
26
+ tgt_spm_nbest_size: 1
27
+ tgt_spm_alpha: 1.0
28
+ corpora:
29
+ - src_file: "train.cleaned.filtered.eng"
30
+ tgt_file: "train.cleaned.filtered.ukr"
31
+ weight: 1
32
+ start_step: 1000
33
+ - src_file: "finetranslations.ukr_Cyrl-eng_Latn.eng_Latn"
34
+ tgt_file: "finetranslations.ukr_Cyrl-eng_Latn.ukr_Cyrl"
35
+ weight: 1
36
+ start_step: 0
37
+ stop_step: 80000
38
+
39
+ train:
40
+ experiment_name: "enuk-base"
41
+ aim_repo: ".aim"
42
+ lr: 2.5e-3
43
+ grad_clip: 0.5
44
+ accum_steps: 20
45
+ max_checkpoints: 10
46
+ precision: "bfloat16"
47
+ warmup_steps: 5000
48
+ max_steps: 200000
49
+ eval_steps: 1000
50
+
51
+ export:
52
+ k: 5
source_vocabulary.json ADDED
The diff for this file is too large to render. See raw diff
 
src.spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4a711986816af3b2072bc648ce419a3c9aa7b466e241539732ea7ed7c23a335
3
+ size 804561
target_vocabulary.json ADDED
The diff for this file is too large to render. See raw diff
 
tgt.spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1135e847f628b43e825ab0c64b11989bb51636c3d16e079c17ccbdfdc3619d55
3
+ size 1014232