Translation
Arabic
English
Eval Results (legacy)
radinplaid commited on
Commit
b6fa323
·
verified ·
1 Parent(s): 6464fd9

Delete .ipynb_checkpoints

Browse files
.ipynb_checkpoints/EADME-checkpoint.md DELETED
@@ -1,116 +0,0 @@
1
- ---
2
- language:
3
- - ar
4
- - en
5
- tags:
6
- - translation
7
- license: cc-by-4.0
8
- datasets:
9
- - quickmt/quickmt-train.ar-en
10
- - quickmt/madlad400-en-backtranslated-ar
11
- - quickmt/newscrawl2024-en-backtranslated-ar
12
- model-index:
13
- - name: quickmt-ar-en
14
- results:
15
- - task:
16
- name: Translation arb-eng
17
- type: translation
18
- args: arb-eng
19
- dataset:
20
- name: flores101-devtest
21
- type: flores_101
22
- args: arb_Arab eng_Latn devtest
23
- metrics:
24
- - name: BLEU
25
- type: bleu
26
- value: 44.11
27
- - name: CHRF
28
- type: chrf
29
- value: 67.96
30
- - name: COMET
31
- type: comet
32
- value: 87.64
33
- ---
34
-
35
-
36
- # `quickmt-ar-en` Neural Machine Translation Model
37
-
38
- `quickmt-ar-en` is a reasonably fast and reasonably accurate neural machine translation model for translation from `ar` into `en`.
39
-
40
- `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).
41
-
42
-
43
- ## *UPDATED VERSION!*
44
-
45
- This model was trained with back-translated data and has improved translation quality!
46
-
47
-
48
- ## Try it on our Huggingface Space
49
-
50
- Give it a try before downloading here: https://huggingface.co/spaces/quickmt/QuickMT-Demo
51
-
52
-
53
- ## Model Information
54
-
55
- * Trained using [`eole`](https://github.com/eole-nlp/eole)
56
- * 200M parameter seq2seq transformer
57
- * 32k separate Sentencepiece vocabs
58
- * Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format
59
- * The pytorch model (for use with [`eole`](https://github.com/eole-nlp/eole)) is available in this repository in the `eole-model` folder
60
-
61
- See the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.
62
-
63
-
64
- ## Usage with `quickmt`
65
-
66
- You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
67
-
68
- Next, install the `quickmt` python library and download the model:
69
-
70
- ```bash
71
- git clone https://github.com/quickmt/quickmt.git
72
- pip install -e ./quickmt/
73
-
74
- quickmt-model-download quickmt/quickmt-ar-en ./quickmt-ar-en
75
- ```
76
-
77
- Finally use the model in python:
78
-
79
- ```python
80
- from quickmt import Translator
81
-
82
- # Auto-detects GPU, set to "cpu" to force CPU inference
83
- mt = Translator("./quickmt-ar-en/", device="auto")
84
-
85
- # Translate - set beam size to 1 for faster speed (but lower quality)
86
- sample_text = 'نبه الدكتور إيهود أور -أستاذ الطب في جامعة دالهوزي في هاليفاكس، نوفا سكوتيا ورئيس الشعبة الطبية والعلمية في الجمعية الكندية للسكري- إلى أن البحث لا يزال في أيامه الأولى.'
87
-
88
- mt(sample_text, beam_size=5)
89
- ```
90
-
91
- > 'Dr. Ehud Orr, a professor of medicine at Dalhousie University in Halifax, Nova Scotia and head of the medical and scientific division of the Canadian Diabetes Association, warned that the research is still in its early days.'
92
-
93
- ```python
94
- # Get alternative translations by sampling
95
- # You can pass any cTranslate2 `translate_batch` arguments
96
- mt([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
97
- ```
98
-
99
- > 'Dr. Ehr, professor of medicine at Dalhousie University in Halifax, Nova Scotia and chief of the medical and scientific division at the Canadian Diabetes Association, warned that the research is still in its early days.'
100
-
101
- 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.
102
-
103
-
104
- ## Metrics
105
-
106
- `bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores). `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 the flores-devtest dataset (1012 sentences) on an RTX 4070s GPU with batch size 32.
107
-
108
-
109
- | | bleu | chrf2 | comet22 | Time (s) |
110
- |:---------------------------------|-------:|--------:|----------:|-----------:|
111
- | quickmt/quickmt-ar-en | 44.11 | 67.96 | 87.64 | 1.11 |
112
- | Helsinki-NLP/opus-mt-ar-en | 34.22 | 61.26 | 84.5 | 3.67 |
113
- | facebook/nllb-200-distilled-600M | 39.13 | 64.14 | 86.22 | 21.76 |
114
- | facebook/nllb-200-distilled-1.3B | 42.29 | 66.55 | 87.55 | 37.7 |
115
- | facebook/m2m100_418M | 29.41 | 57.68 | 82.21 | 18.53 |
116
- | facebook/m2m100_1.2B | 29.77 | 56.7 | 80.77 | 36.23 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.ipynb_checkpoints/README-checkpoint.md DELETED
@@ -1,100 +0,0 @@
1
- ---
2
- language:
3
- - en
4
- - ko
5
- tags:
6
- - translation
7
- license: cc-by-4.0
8
- datasets:
9
- - quickmt/quickmt-train.ar-en
10
- model-index:
11
- - name: quickmt-ar-en
12
- results:
13
- - task:
14
- name: Translation ara-eng
15
- type: translation
16
- args: ara-eng
17
- dataset:
18
- name: flores101-devtest
19
- type: flores_101
20
- args: ara_Arab eng_Latn devtest
21
- metrics:
22
- - name: CHRF
23
- type: chrf
24
- value: 66.98
25
- - name: BLEU
26
- type: bleu
27
- value: 42.79
28
- - name: COMET
29
- type: comet
30
- value: 87.4
31
- ---
32
-
33
-
34
- # `quickmt-ar-en` Neural Machine Translation Model
35
-
36
- `quickmt-ar-en` is a reasonably fast and reasonably accurate neural machine translation model for translation from `ar` into `en`.
37
-
38
-
39
- ## Model Information
40
-
41
- * Trained using [`eole`](https://github.com/eole-nlp/eole)
42
- * 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers
43
- * 20k sentencepiece vocabularies
44
- * Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format
45
- * Training data: https://huggingface.co/datasets/quickmt/quickmt-train.ar-en/tree/main
46
-
47
- See the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.
48
-
49
-
50
- ## Usage with `quickmt`
51
-
52
- You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
53
-
54
- Next, install the `quickmt` python library and download the model:
55
-
56
- ```bash
57
- git clone https://github.com/quickmt/quickmt.git
58
- pip install ./quickmt/
59
-
60
- quickmt-model-download quickmt/quickmt-ar-en ./quickmt-ar-en
61
- ```
62
-
63
- Finally use the model in python:
64
-
65
- ```python
66
- from quickmt import Translator
67
-
68
- # Auto-detects GPU, set to "cpu" to force CPU inference
69
- t = Translator("./quickmt-ar-en/", device="auto")
70
-
71
- # Translate - set beam size to 5 for higher quality (but slower speed)
72
- sample_text = 'نبه الدكتور إيهود أور -أستاذ الطب في جامعة دالهوزي في هاليفاكس، نوفا سكوتيا ورئيس الشعبة الطبية والعلمية في الجمعية الكندية للسكري- إلى أن البحث لا يزال في أيامه الأولى.'
73
- t(sample_text, beam_size=5)
74
-
75
- > 'Dr. Ehud Orr, professor of medicine at Dalhousie University in Halifax, Nova Scotia and head of the medical and scientific division of the Canadian Diabetes Association, warned that the research is still in its early days.'
76
-
77
- # Get alternative translations by sampling
78
- # You can pass any cTranslate2 `translate_batch` arguments
79
- t([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
80
-
81
- > 'Professor of Medicine at Dalhousie University in Halifax, Nova Scotia and chairman of the Medical and Scientific Division at the Canadian Diabetes Society, cautioned that the research was still in its early days.'
82
- ```
83
-
84
- 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`.
85
-
86
-
87
- ## Metrics
88
-
89
- `bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores) ("kor_Hang"->"eng_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 (faster speed is possible using a large batch size).
90
-
91
- | | bleu | chrf2 | comet22 | Time (s) |
92
- |:---------------------------------|-------:|--------:|----------:|-----------:|
93
- | quickmt/quickmt-ar-en | 42.79 | 66.98 | 87.4 | 0.88 |
94
- | Helsink-NLP/opus-mt-ar-en | 34.22 | 61.26 | 84.5 | 3.78 |
95
- | facebook/nllb-200-distilled-600M | 39.13 | 64.14 | 86.22 | 21.58 |
96
- | facebook/nllb-200-distilled-1.3B | 42.29 | 66.55 | 87.55 | 37.7 |
97
- | facebook/m2m100_418M | 29.41 | 57.68 | 82.21 | 18.5 |
98
- | facebook/m2m100_1.2B | 29.77 | 56.7 | 80.77 | 36.23 |
99
-
100
- `quickmt-ar-en` is the fastest and highest quality.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.ipynb_checkpoints/eole-config-checkpoint.yaml DELETED
@@ -1,104 +0,0 @@
1
- ## IO
2
- save_data: ar-en/data
3
- overwrite: True
4
- seed: 1234
5
- report_every: 100
6
- valid_metrics: ["BLEU"]
7
- tensorboard: true
8
- tensorboard_log_dir: tensorboard
9
-
10
- ### Vocab
11
- src_vocab: ar.eole.vocab
12
- tgt_vocab: en.eole.vocab
13
- src_vocab_size: 20000
14
- tgt_vocab_size: 20000
15
- vocab_size_multiple: 8
16
- share_vocab: false
17
- n_sample: 0
18
-
19
- data:
20
- corpus_1:
21
- path_src: hf://quickmt/quickmt-train.ar-en/ar
22
- path_tgt: hf://quickmt/quickmt-train.ar-en/en
23
- path_sco: hf://quickmt/quickmt-train.ar-en/sco
24
- valid:
25
- path_src: flores-dev.ar
26
- path_tgt: flores-dev.en
27
-
28
- transforms: [sentencepiece, filtertoolong]
29
- transforms_configs:
30
- sentencepiece:
31
- src_subword_model: "ar.spm.model"
32
- tgt_subword_model: "en.spm.model"
33
- src_subword_alpha: 0.5
34
- src_subword_nbest: -1
35
- filtertoolong:
36
- src_seq_length: 256
37
- tgt_seq_length: 256
38
-
39
- training:
40
- # Run configuration
41
- model_path: model
42
- train_from: model
43
- keep_checkpoint: 4
44
- save_checkpoint_steps: 1000
45
- train_steps: 200000
46
- valid_steps: 1000
47
-
48
- # Train on a single GPU
49
- world_size: 1
50
- gpu_ranks: [0]
51
-
52
- # Batching
53
- batch_type: "tokens"
54
- batch_size: 8192
55
- valid_batch_size: 8192
56
- batch_size_multiple: 8
57
- accum_count: [16]
58
- accum_steps: [0]
59
-
60
- # Optimizer & Compute
61
- compute_dtype: "fp16"
62
- #use_amp: true
63
- optim: "pagedadamw8bit"
64
- learning_rate: 2.0
65
- warmup_steps: 5000
66
- decay_method: "noam"
67
- adam_beta2: 0.998
68
-
69
- # Data loading
70
- bucket_size: 128000
71
- num_workers: 4
72
- prefetch_factor: 32
73
-
74
- # Hyperparams
75
- dropout_steps: [0]
76
- dropout: [0.1]
77
- attention_dropout: [0]
78
- max_grad_norm: 2
79
- label_smoothing: 0.1
80
- average_decay: 0.0001
81
- param_init_method: xavier_uniform
82
- normalization: "tokens"
83
-
84
- model:
85
- architecture: "transformer"
86
- layer_norm: standard
87
- share_embeddings: false
88
- share_decoder_embeddings: true
89
- add_ffnbias: true
90
- mlp_activation_fn: gelu
91
- add_estimator: false
92
- add_qkvbias: false
93
- norm_eps: 1e-6
94
- hidden_size: 1024
95
- encoder:
96
- layers: 8
97
- decoder:
98
- layers: 2
99
- heads: 8
100
- transformer_ff: 4096
101
- embeddings:
102
- word_vec_size: 1024
103
- position_encoding_type: "SinusoidalInterleaved"
104
-