Upload folder using huggingface_hub
Browse files- .ipynb_checkpoints/README-checkpoint.md +98 -0
- .ipynb_checkpoints/config-checkpoint.json +10 -0
- .ipynb_checkpoints/eole-config-checkpoint.yaml +102 -0
- README.md +98 -3
- config.json +10 -0
- eole-config.yaml +102 -0
- eole-model/config.json +149 -0
- eole-model/de.spm.model +3 -0
- eole-model/en.spm.model +3 -0
- eole-model/model.00.safetensors +3 -0
- eole-model/vocab.json +0 -0
- model.bin +3 -0
- source_vocabulary.json +0 -0
- src.spm.model +3 -0
- target_vocabulary.json +0 -0
- tgt.spm.model +3 -0
.ipynb_checkpoints/README-checkpoint.md
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- de
|
5 |
+
tags:
|
6 |
+
- translation
|
7 |
+
license: cc-by-4.0
|
8 |
+
datasets:
|
9 |
+
- quickmt/quickmt-train.de-en
|
10 |
+
model-index:
|
11 |
+
- name: quickmt-en-de
|
12 |
+
results:
|
13 |
+
- task:
|
14 |
+
name: Translation eng-deu
|
15 |
+
type: translation
|
16 |
+
args: eng-deu
|
17 |
+
dataset:
|
18 |
+
name: flores101-devtest
|
19 |
+
type: flores_101
|
20 |
+
args: eng_Latn deu_Latn devtest
|
21 |
+
metrics:
|
22 |
+
- name: CHRF
|
23 |
+
type: chrf
|
24 |
+
value: 66.26
|
25 |
+
- name: BLEU
|
26 |
+
type: bleu
|
27 |
+
value: 40.17
|
28 |
+
- name: COMET
|
29 |
+
type: comet
|
30 |
+
value: 86.91
|
31 |
+
---
|
32 |
+
|
33 |
+
# `quickmt-en-de` Neural Machine Translation Model
|
34 |
+
|
35 |
+
`quickmt-en-de` is a reasonably fast and reasonably accurate neural machine translation model for translation from `de` into `en`.
|
36 |
+
|
37 |
+
|
38 |
+
## Model Information
|
39 |
+
|
40 |
+
* Trained using [`eole`](https://github.com/eole-nlp/eole)
|
41 |
+
* 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers
|
42 |
+
* 20k separate Sentencepiece vocabularies
|
43 |
+
* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format
|
44 |
+
* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.de-en/tree/main
|
45 |
+
|
46 |
+
See the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.
|
47 |
+
|
48 |
+
## Usage with `quickmt`
|
49 |
+
|
50 |
+
You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
|
51 |
+
|
52 |
+
Next, install the `quickmt` python library and download the model:
|
53 |
+
|
54 |
+
```bash
|
55 |
+
git clone https://github.com/quickmt/quickmt.git
|
56 |
+
pip install ./quickmt/
|
57 |
+
|
58 |
+
quickmt-model-download quickmt/quickmt-en-de ./quickmt-en-de
|
59 |
+
```
|
60 |
+
|
61 |
+
Finally use the model in python:
|
62 |
+
|
63 |
+
```python
|
64 |
+
from quickmt import Translator
|
65 |
+
|
66 |
+
# Auto-detects GPU, set to "cpu" to force CPU inference
|
67 |
+
t = Translator("./quickmt-en-de/", device="auto")
|
68 |
+
|
69 |
+
# Translate - set beam size to 5 for higher quality (but slower speed)
|
70 |
+
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.'
|
71 |
+
|
72 |
+
t(sample_text, beam_size=5)
|
73 |
+
|
74 |
+
> 'Dr. Ehud Ur, Professor für Medizin an der Dalhousie University in Halifax, Nova Scotia und Vorsitzender der klinischen und wissenschaftlichen Abteilung der Canadian Diabetes Association warnte, dass die Forschung noch in ihren frühen Tagen ist.'
|
75 |
+
|
76 |
+
# Get alternative translations by sampling
|
77 |
+
# You can pass any cTranslate2 `translate_batch` arguments
|
78 |
+
t([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
|
79 |
+
|
80 |
+
```
|
81 |
+
|
82 |
+
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`.
|
83 |
+
|
84 |
+
|
85 |
+
## Metrics
|
86 |
+
|
87 |
+
`bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores) ("deu_Latn"->"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).
|
88 |
+
|
89 |
+
| | bleu | chrf2 | comet22 | Time (s) |
|
90 |
+
|:---------------------------------|-------:|--------:|----------:|-----------:|
|
91 |
+
| quickmt/quickmt-en-de | 40.17 | 66.26 | 86.91 | 1.1 |
|
92 |
+
| Helsink-NLP/opus-mt-en-de | 36.06 | 63.53 | 84.63 | 3.72 |
|
93 |
+
| facebook/nllb-200-distilled-600M | 35.72 | 63.41 | 86.65 | 26.93 |
|
94 |
+
| facebook/nllb-200-distilled-1.3B | 38.61 | 65.01 | 87.99 | 46.57 |
|
95 |
+
| facebook/m2m100_418M | 28.57 | 57.76 | 79.75 | 21.46 |
|
96 |
+
| facebook/m2m100_1.2B | 36.24 | 63.37 | 85.82 | 41.5 |
|
97 |
+
|
98 |
+
`quickmt-en-de` is the fastest and highest quality (except possibly for nllb-200-distilled-1.3B which has a higher comet22 score).
|
.ipynb_checkpoints/config-checkpoint.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_source_bos": false,
|
3 |
+
"add_source_eos": false,
|
4 |
+
"bos_token": "<s>",
|
5 |
+
"decoder_start_token": "<s>",
|
6 |
+
"eos_token": "</s>",
|
7 |
+
"layer_norm_epsilon": 1e-06,
|
8 |
+
"multi_query_attention": false,
|
9 |
+
"unk_token": "<unk>"
|
10 |
+
}
|
.ipynb_checkpoints/eole-config-checkpoint.yaml
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## IO
|
2 |
+
save_data: en-de/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: en.eole.vocab
|
12 |
+
tgt_vocab: de.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.de-en/en
|
22 |
+
path_tgt: hf://quickmt/quickmt-train.de-en/de
|
23 |
+
path_sco: hf://quickmt/quickmt-train.de-en/sco
|
24 |
+
valid:
|
25 |
+
path_src: dev.en
|
26 |
+
path_tgt: dev.de
|
27 |
+
|
28 |
+
transforms: [sentencepiece, filtertoolong]
|
29 |
+
transforms_configs:
|
30 |
+
sentencepiece:
|
31 |
+
src_subword_model: "en.spm.model"
|
32 |
+
tgt_subword_model: "de.spm.model"
|
33 |
+
filtertoolong:
|
34 |
+
src_seq_length: 256
|
35 |
+
tgt_seq_length: 256
|
36 |
+
|
37 |
+
training:
|
38 |
+
# Run configuration
|
39 |
+
model_path: model
|
40 |
+
#train_from: model
|
41 |
+
keep_checkpoint: 4
|
42 |
+
save_checkpoint_steps: 1000
|
43 |
+
train_steps: 200000
|
44 |
+
valid_steps: 1000
|
45 |
+
|
46 |
+
# Train on a single GPU
|
47 |
+
world_size: 1
|
48 |
+
gpu_ranks: [0]
|
49 |
+
|
50 |
+
# Batching
|
51 |
+
batch_type: "tokens"
|
52 |
+
batch_size: 16384
|
53 |
+
valid_batch_size: 16384
|
54 |
+
batch_size_multiple: 8
|
55 |
+
accum_count: [8]
|
56 |
+
accum_steps: [0]
|
57 |
+
|
58 |
+
# Optimizer & Compute
|
59 |
+
compute_dtype: "fp16"
|
60 |
+
#use_amp: true
|
61 |
+
optim: "pagedadamw8bit"
|
62 |
+
learning_rate: 2.0
|
63 |
+
warmup_steps: 5000
|
64 |
+
decay_method: "noam"
|
65 |
+
adam_beta2: 0.998
|
66 |
+
|
67 |
+
# Data loading
|
68 |
+
bucket_size: 128000
|
69 |
+
num_workers: 4
|
70 |
+
prefetch_factor: 32
|
71 |
+
|
72 |
+
# Hyperparams
|
73 |
+
dropout_steps: [0]
|
74 |
+
dropout: [0.1]
|
75 |
+
attention_dropout: [0]
|
76 |
+
max_grad_norm: 2
|
77 |
+
label_smoothing: 0.1
|
78 |
+
average_decay: 0.0001
|
79 |
+
param_init_method: xavier_uniform
|
80 |
+
normalization: "tokens"
|
81 |
+
|
82 |
+
model:
|
83 |
+
architecture: "transformer"
|
84 |
+
layer_norm: standard
|
85 |
+
share_embeddings: false
|
86 |
+
share_decoder_embeddings: true
|
87 |
+
add_ffnbias: true
|
88 |
+
mlp_activation_fn: gelu
|
89 |
+
add_estimator: false
|
90 |
+
add_qkvbias: false
|
91 |
+
norm_eps: 1e-6
|
92 |
+
hidden_size: 1024
|
93 |
+
encoder:
|
94 |
+
layers: 8
|
95 |
+
decoder:
|
96 |
+
layers: 2
|
97 |
+
heads: 8
|
98 |
+
transformer_ff: 4096
|
99 |
+
embeddings:
|
100 |
+
word_vec_size: 1024
|
101 |
+
position_encoding_type: "SinusoidalInterleaved"
|
102 |
+
|
README.md
CHANGED
@@ -1,3 +1,98 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- de
|
5 |
+
tags:
|
6 |
+
- translation
|
7 |
+
license: cc-by-4.0
|
8 |
+
datasets:
|
9 |
+
- quickmt/quickmt-train.de-en
|
10 |
+
model-index:
|
11 |
+
- name: quickmt-en-de
|
12 |
+
results:
|
13 |
+
- task:
|
14 |
+
name: Translation eng-deu
|
15 |
+
type: translation
|
16 |
+
args: eng-deu
|
17 |
+
dataset:
|
18 |
+
name: flores101-devtest
|
19 |
+
type: flores_101
|
20 |
+
args: eng_Latn deu_Latn devtest
|
21 |
+
metrics:
|
22 |
+
- name: CHRF
|
23 |
+
type: chrf
|
24 |
+
value: 66.26
|
25 |
+
- name: BLEU
|
26 |
+
type: bleu
|
27 |
+
value: 40.17
|
28 |
+
- name: COMET
|
29 |
+
type: comet
|
30 |
+
value: 86.91
|
31 |
+
---
|
32 |
+
|
33 |
+
# `quickmt-en-de` Neural Machine Translation Model
|
34 |
+
|
35 |
+
`quickmt-en-de` is a reasonably fast and reasonably accurate neural machine translation model for translation from `de` into `en`.
|
36 |
+
|
37 |
+
|
38 |
+
## Model Information
|
39 |
+
|
40 |
+
* Trained using [`eole`](https://github.com/eole-nlp/eole)
|
41 |
+
* 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers
|
42 |
+
* 20k separate Sentencepiece vocabularies
|
43 |
+
* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format
|
44 |
+
* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.de-en/tree/main
|
45 |
+
|
46 |
+
See the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.
|
47 |
+
|
48 |
+
## Usage with `quickmt`
|
49 |
+
|
50 |
+
You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
|
51 |
+
|
52 |
+
Next, install the `quickmt` python library and download the model:
|
53 |
+
|
54 |
+
```bash
|
55 |
+
git clone https://github.com/quickmt/quickmt.git
|
56 |
+
pip install ./quickmt/
|
57 |
+
|
58 |
+
quickmt-model-download quickmt/quickmt-en-de ./quickmt-en-de
|
59 |
+
```
|
60 |
+
|
61 |
+
Finally use the model in python:
|
62 |
+
|
63 |
+
```python
|
64 |
+
from quickmt import Translator
|
65 |
+
|
66 |
+
# Auto-detects GPU, set to "cpu" to force CPU inference
|
67 |
+
t = Translator("./quickmt-en-de/", device="auto")
|
68 |
+
|
69 |
+
# Translate - set beam size to 5 for higher quality (but slower speed)
|
70 |
+
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.'
|
71 |
+
|
72 |
+
t(sample_text, beam_size=5)
|
73 |
+
|
74 |
+
> 'Dr. Ehud Ur, Professor für Medizin an der Dalhousie University in Halifax, Nova Scotia und Vorsitzender der klinischen und wissenschaftlichen Abteilung der Canadian Diabetes Association warnte, dass die Forschung noch in ihren frühen Tagen ist.'
|
75 |
+
|
76 |
+
# Get alternative translations by sampling
|
77 |
+
# You can pass any cTranslate2 `translate_batch` arguments
|
78 |
+
t([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
|
79 |
+
|
80 |
+
```
|
81 |
+
|
82 |
+
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`.
|
83 |
+
|
84 |
+
|
85 |
+
## Metrics
|
86 |
+
|
87 |
+
`bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores) ("deu_Latn"->"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).
|
88 |
+
|
89 |
+
| | bleu | chrf2 | comet22 | Time (s) |
|
90 |
+
|:---------------------------------|-------:|--------:|----------:|-----------:|
|
91 |
+
| quickmt/quickmt-en-de | 40.17 | 66.26 | 86.91 | 1.1 |
|
92 |
+
| Helsink-NLP/opus-mt-en-de | 36.06 | 63.53 | 84.63 | 3.72 |
|
93 |
+
| facebook/nllb-200-distilled-600M | 35.72 | 63.41 | 86.65 | 26.93 |
|
94 |
+
| facebook/nllb-200-distilled-1.3B | 38.61 | 65.01 | 87.99 | 46.57 |
|
95 |
+
| facebook/m2m100_418M | 28.57 | 57.76 | 79.75 | 21.46 |
|
96 |
+
| facebook/m2m100_1.2B | 36.24 | 63.37 | 85.82 | 41.5 |
|
97 |
+
|
98 |
+
`quickmt-en-de` is the fastest and highest quality (except possibly for nllb-200-distilled-1.3B which has a higher comet22 score).
|
config.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_source_bos": false,
|
3 |
+
"add_source_eos": false,
|
4 |
+
"bos_token": "<s>",
|
5 |
+
"decoder_start_token": "<s>",
|
6 |
+
"eos_token": "</s>",
|
7 |
+
"layer_norm_epsilon": 1e-06,
|
8 |
+
"multi_query_attention": false,
|
9 |
+
"unk_token": "<unk>"
|
10 |
+
}
|
eole-config.yaml
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## IO
|
2 |
+
save_data: en-de/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: en.eole.vocab
|
12 |
+
tgt_vocab: de.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.de-en/en
|
22 |
+
path_tgt: hf://quickmt/quickmt-train.de-en/de
|
23 |
+
path_sco: hf://quickmt/quickmt-train.de-en/sco
|
24 |
+
valid:
|
25 |
+
path_src: dev.en
|
26 |
+
path_tgt: dev.de
|
27 |
+
|
28 |
+
transforms: [sentencepiece, filtertoolong]
|
29 |
+
transforms_configs:
|
30 |
+
sentencepiece:
|
31 |
+
src_subword_model: "en.spm.model"
|
32 |
+
tgt_subword_model: "de.spm.model"
|
33 |
+
filtertoolong:
|
34 |
+
src_seq_length: 256
|
35 |
+
tgt_seq_length: 256
|
36 |
+
|
37 |
+
training:
|
38 |
+
# Run configuration
|
39 |
+
model_path: model
|
40 |
+
#train_from: model
|
41 |
+
keep_checkpoint: 4
|
42 |
+
save_checkpoint_steps: 1000
|
43 |
+
train_steps: 200000
|
44 |
+
valid_steps: 1000
|
45 |
+
|
46 |
+
# Train on a single GPU
|
47 |
+
world_size: 1
|
48 |
+
gpu_ranks: [0]
|
49 |
+
|
50 |
+
# Batching
|
51 |
+
batch_type: "tokens"
|
52 |
+
batch_size: 16384
|
53 |
+
valid_batch_size: 16384
|
54 |
+
batch_size_multiple: 8
|
55 |
+
accum_count: [8]
|
56 |
+
accum_steps: [0]
|
57 |
+
|
58 |
+
# Optimizer & Compute
|
59 |
+
compute_dtype: "fp16"
|
60 |
+
#use_amp: true
|
61 |
+
optim: "pagedadamw8bit"
|
62 |
+
learning_rate: 2.0
|
63 |
+
warmup_steps: 5000
|
64 |
+
decay_method: "noam"
|
65 |
+
adam_beta2: 0.998
|
66 |
+
|
67 |
+
# Data loading
|
68 |
+
bucket_size: 128000
|
69 |
+
num_workers: 4
|
70 |
+
prefetch_factor: 32
|
71 |
+
|
72 |
+
# Hyperparams
|
73 |
+
dropout_steps: [0]
|
74 |
+
dropout: [0.1]
|
75 |
+
attention_dropout: [0]
|
76 |
+
max_grad_norm: 2
|
77 |
+
label_smoothing: 0.1
|
78 |
+
average_decay: 0.0001
|
79 |
+
param_init_method: xavier_uniform
|
80 |
+
normalization: "tokens"
|
81 |
+
|
82 |
+
model:
|
83 |
+
architecture: "transformer"
|
84 |
+
layer_norm: standard
|
85 |
+
share_embeddings: false
|
86 |
+
share_decoder_embeddings: true
|
87 |
+
add_ffnbias: true
|
88 |
+
mlp_activation_fn: gelu
|
89 |
+
add_estimator: false
|
90 |
+
add_qkvbias: false
|
91 |
+
norm_eps: 1e-6
|
92 |
+
hidden_size: 1024
|
93 |
+
encoder:
|
94 |
+
layers: 8
|
95 |
+
decoder:
|
96 |
+
layers: 2
|
97 |
+
heads: 8
|
98 |
+
transformer_ff: 4096
|
99 |
+
embeddings:
|
100 |
+
word_vec_size: 1024
|
101 |
+
position_encoding_type: "SinusoidalInterleaved"
|
102 |
+
|
eole-model/config.json
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"share_vocab": false,
|
3 |
+
"tensorboard": true,
|
4 |
+
"tensorboard_log_dir": "tensorboard",
|
5 |
+
"tensorboard_log_dir_dated": "tensorboard/Mar-19_23-32-41",
|
6 |
+
"save_data": "en-de/data",
|
7 |
+
"overwrite": true,
|
8 |
+
"tgt_vocab_size": 20000,
|
9 |
+
"seed": 1234,
|
10 |
+
"transforms": [
|
11 |
+
"sentencepiece",
|
12 |
+
"filtertoolong"
|
13 |
+
],
|
14 |
+
"valid_metrics": [
|
15 |
+
"BLEU"
|
16 |
+
],
|
17 |
+
"src_vocab_size": 20000,
|
18 |
+
"src_vocab": "en.eole.vocab",
|
19 |
+
"tgt_vocab": "de.eole.vocab",
|
20 |
+
"report_every": 100,
|
21 |
+
"vocab_size_multiple": 8,
|
22 |
+
"n_sample": 0,
|
23 |
+
"training": {
|
24 |
+
"adam_beta2": 0.998,
|
25 |
+
"warmup_steps": 5000,
|
26 |
+
"label_smoothing": 0.1,
|
27 |
+
"prefetch_factor": 32,
|
28 |
+
"num_workers": 0,
|
29 |
+
"batch_size": 16384,
|
30 |
+
"optim": "pagedadamw8bit",
|
31 |
+
"normalization": "tokens",
|
32 |
+
"save_checkpoint_steps": 1000,
|
33 |
+
"compute_dtype": "torch.float16",
|
34 |
+
"max_grad_norm": 2.0,
|
35 |
+
"average_decay": 0.0001,
|
36 |
+
"gpu_ranks": [
|
37 |
+
0
|
38 |
+
],
|
39 |
+
"decay_method": "noam",
|
40 |
+
"batch_size_multiple": 8,
|
41 |
+
"dropout_steps": [
|
42 |
+
0
|
43 |
+
],
|
44 |
+
"param_init_method": "xavier_uniform",
|
45 |
+
"world_size": 1,
|
46 |
+
"valid_steps": 1000,
|
47 |
+
"dropout": [
|
48 |
+
0.1
|
49 |
+
],
|
50 |
+
"accum_steps": [
|
51 |
+
0
|
52 |
+
],
|
53 |
+
"attention_dropout": [
|
54 |
+
0.0
|
55 |
+
],
|
56 |
+
"accum_count": [
|
57 |
+
8
|
58 |
+
],
|
59 |
+
"learning_rate": 2.0,
|
60 |
+
"batch_type": "tokens",
|
61 |
+
"bucket_size": 128000,
|
62 |
+
"valid_batch_size": 16384,
|
63 |
+
"keep_checkpoint": 4,
|
64 |
+
"train_steps": 200000,
|
65 |
+
"model_path": "model"
|
66 |
+
},
|
67 |
+
"transforms_configs": {
|
68 |
+
"filtertoolong": {
|
69 |
+
"tgt_seq_length": 256,
|
70 |
+
"src_seq_length": 256
|
71 |
+
},
|
72 |
+
"sentencepiece": {
|
73 |
+
"src_subword_model": "${MODEL_PATH}/en.spm.model",
|
74 |
+
"tgt_subword_model": "${MODEL_PATH}/de.spm.model"
|
75 |
+
}
|
76 |
+
},
|
77 |
+
"model": {
|
78 |
+
"hidden_size": 1024,
|
79 |
+
"add_ffnbias": true,
|
80 |
+
"transformer_ff": 4096,
|
81 |
+
"norm_eps": 1e-06,
|
82 |
+
"add_qkvbias": false,
|
83 |
+
"mlp_activation_fn": "gelu",
|
84 |
+
"architecture": "transformer",
|
85 |
+
"share_decoder_embeddings": true,
|
86 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
87 |
+
"share_embeddings": false,
|
88 |
+
"heads": 8,
|
89 |
+
"add_estimator": false,
|
90 |
+
"layer_norm": "standard",
|
91 |
+
"decoder": {
|
92 |
+
"mlp_activation_fn": "gelu",
|
93 |
+
"hidden_size": 1024,
|
94 |
+
"decoder_type": "transformer",
|
95 |
+
"add_ffnbias": true,
|
96 |
+
"n_positions": null,
|
97 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
98 |
+
"layers": 2,
|
99 |
+
"transformer_ff": 4096,
|
100 |
+
"tgt_word_vec_size": 1024,
|
101 |
+
"heads": 8,
|
102 |
+
"norm_eps": 1e-06,
|
103 |
+
"layer_norm": "standard",
|
104 |
+
"add_qkvbias": false
|
105 |
+
},
|
106 |
+
"embeddings": {
|
107 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
108 |
+
"tgt_word_vec_size": 1024,
|
109 |
+
"word_vec_size": 1024,
|
110 |
+
"src_word_vec_size": 1024
|
111 |
+
},
|
112 |
+
"encoder": {
|
113 |
+
"mlp_activation_fn": "gelu",
|
114 |
+
"hidden_size": 1024,
|
115 |
+
"src_word_vec_size": 1024,
|
116 |
+
"add_ffnbias": true,
|
117 |
+
"n_positions": null,
|
118 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
119 |
+
"encoder_type": "transformer",
|
120 |
+
"layers": 8,
|
121 |
+
"transformer_ff": 4096,
|
122 |
+
"heads": 8,
|
123 |
+
"norm_eps": 1e-06,
|
124 |
+
"layer_norm": "standard",
|
125 |
+
"add_qkvbias": false
|
126 |
+
}
|
127 |
+
},
|
128 |
+
"data": {
|
129 |
+
"corpus_1": {
|
130 |
+
"path_align": null,
|
131 |
+
"transforms": [
|
132 |
+
"sentencepiece",
|
133 |
+
"filtertoolong"
|
134 |
+
],
|
135 |
+
"path_sco": "hf://quickmt/quickmt-train.de-en/sco",
|
136 |
+
"path_tgt": "hf://quickmt/quickmt-train.de-en/de",
|
137 |
+
"path_src": "hf://quickmt/quickmt-train.de-en/en"
|
138 |
+
},
|
139 |
+
"valid": {
|
140 |
+
"path_align": null,
|
141 |
+
"path_src": "dev.en",
|
142 |
+
"transforms": [
|
143 |
+
"sentencepiece",
|
144 |
+
"filtertoolong"
|
145 |
+
],
|
146 |
+
"path_tgt": "dev.de"
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
eole-model/de.spm.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4a4a9e3dd26d6562764eb2678f95766afbab48354ddb5b7d63cb7cf7a02cf56a
|
3 |
+
size 595491
|
eole-model/en.spm.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eaf7051931aaca182561ba5a63c5674424971d0d6001ab57facb194fe6c941bf
|
3 |
+
size 586141
|
eole-model/model.00.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bce829962ff8f200bcb951ae5da7a3e1d52029829f265144a5fd0b9e376051c5
|
3 |
+
size 742170000
|
eole-model/vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f376421d5851fd4b130025c5469a1a2772c8950f560d77383548684802d73533
|
3 |
+
size 360843109
|
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:eaf7051931aaca182561ba5a63c5674424971d0d6001ab57facb194fe6c941bf
|
3 |
+
size 586141
|
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:4a4a9e3dd26d6562764eb2678f95766afbab48354ddb5b7d63cb7cf7a02cf56a
|
3 |
+
size 595491
|