Upload folder using huggingface_hub
Browse files- .ipynb_checkpoints/README-checkpoint.md +105 -0
- .ipynb_checkpoints/eole-config-checkpoint.yaml +97 -0
- README.md +105 -3
- config.json +10 -0
- eole-config.yaml +97 -0
- eole-model/config.json +132 -0
- eole-model/da.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,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- da
|
| 5 |
+
tags:
|
| 6 |
+
- translation
|
| 7 |
+
license: cc-by-4.0
|
| 8 |
+
datasets:
|
| 9 |
+
- quickmt/quickmt-train.da-en
|
| 10 |
+
model-index:
|
| 11 |
+
- name: quickmt-en-da
|
| 12 |
+
results:
|
| 13 |
+
- task:
|
| 14 |
+
name: Translation eng-dan
|
| 15 |
+
type: translation
|
| 16 |
+
args: eng-dan
|
| 17 |
+
dataset:
|
| 18 |
+
name: flores101-devtest
|
| 19 |
+
type: flores_101
|
| 20 |
+
args: eng_Latn dan_Latn devtest
|
| 21 |
+
metrics:
|
| 22 |
+
- name: BLEU
|
| 23 |
+
type: bleu
|
| 24 |
+
value: 46.61
|
| 25 |
+
- name: CHRF
|
| 26 |
+
type: chrf
|
| 27 |
+
value: 70.07
|
| 28 |
+
- name: COMET
|
| 29 |
+
type: comet
|
| 30 |
+
value: 89.49
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# `quickmt-en-da` Neural Machine Translation Model
|
| 35 |
+
|
| 36 |
+
`quickmt-en-da` is a reasonably fast and reasonably accurate neural machine translation model for translation from `en` into `da`.
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
## Try it on our Huggingface Space
|
| 40 |
+
|
| 41 |
+
Give it a try before downloading here: https://huggingface.co/spaces/quickmt/QuickMT-Demo
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
## Model Information
|
| 45 |
+
|
| 46 |
+
* Trained using [`eole`](https://github.com/eole-nlp/eole)
|
| 47 |
+
* 200M parameter transformer 'big' with 8 encoder layers and 2 decoder layers
|
| 48 |
+
* 32k separate Sentencepiece vocabs
|
| 49 |
+
* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format
|
| 50 |
+
|
| 51 |
+
See the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
## Usage with `quickmt`
|
| 55 |
+
|
| 56 |
+
You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
|
| 57 |
+
|
| 58 |
+
Next, install the `quickmt` python library and download the model:
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
git clone https://github.com/quickmt/quickmt.git
|
| 62 |
+
pip install ./quickmt/
|
| 63 |
+
|
| 64 |
+
quickmt-model-download quickmt/quickmt-en-da ./quickmt-en-da
|
| 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 |
+
t = Translator("./quickmt-en-da/", 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 |
+
t(sample_text, beam_size=5)
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
> 'Dr. Ehud Ur, professor i medicin ved Dalhousie University i Halifax, Nova Scotia og formand for den kliniske og videnskabelige afdeling af Canadian Diabetes Association advarede om, at forskningen stadig er i sine tidlige dage.'
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
# Get alternative translations by sampling
|
| 85 |
+
# You can pass any cTranslate2 `translate_batch` arguments
|
| 86 |
+
t([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
> 'Dr. Ehud Ur, professor i medicin på Dalhousie University i Halifax, Nova Scotia og formand for det kliniske og videnskabelige afdeling af Canadian Diabetes Association advarede om, at forskningen stadig er i sin tidlige dage.'
|
| 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 `eole` 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) ("eng_Latn"->"dan_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 the flores-devtest dataset (1012 sentences) on an Nvidia RTX 4070s GPU with batch size 32.
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
| | bleu | chrf2 | comet22 | Time (s) |
|
| 100 |
+
|:---------------------------------|-------:|--------:|----------:|-----------:|
|
| 101 |
+
| quickmt/quickmt-en-da | 46.61 | 70.07 | 89.49 | 1.19 |
|
| 102 |
+
| facebook/nllb-200-distilled-600M | 41.8 | 66.79 | 89.44 | 22.24 |
|
| 103 |
+
| facebook/nllb-200-distilled-1.3B | 44.02 | 68.52 | 90.73 | 39.32 |
|
| 104 |
+
| facebook/m2m100_418M | 36.81 | 62.93 | 85.35 | 18.97 |
|
| 105 |
+
| facebook/m2m100_1.2B | 44.54 | 68.46 | 89.43 | 37.42 |
|
.ipynb_checkpoints/eole-config-checkpoint.yaml
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## IO
|
| 2 |
+
save_data: 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: da.eole.vocab
|
| 13 |
+
src_vocab_size: 32000
|
| 14 |
+
tgt_vocab_size: 32000
|
| 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.da-en/en
|
| 22 |
+
path_tgt: hf://quickmt/quickmt-train.da-en/da
|
| 23 |
+
path_sco: hf://quickmt/quickmt-train.da-en/sco
|
| 24 |
+
|
| 25 |
+
valid:
|
| 26 |
+
path_src: valid.en
|
| 27 |
+
path_tgt: valid.da
|
| 28 |
+
|
| 29 |
+
transforms: [sentencepiece, filtertoolong]
|
| 30 |
+
transforms_configs:
|
| 31 |
+
sentencepiece:
|
| 32 |
+
src_subword_model: "en.spm.model"
|
| 33 |
+
tgt_subword_model: "da.spm.model"
|
| 34 |
+
filtertoolong:
|
| 35 |
+
src_seq_length: 256
|
| 36 |
+
tgt_seq_length: 256
|
| 37 |
+
|
| 38 |
+
training:
|
| 39 |
+
# Run configuration
|
| 40 |
+
model_path: quickmt-en-da-eole-model
|
| 41 |
+
#train_from: model
|
| 42 |
+
keep_checkpoint: 4
|
| 43 |
+
train_steps: 100000
|
| 44 |
+
save_checkpoint_steps: 5000
|
| 45 |
+
valid_steps: 5000
|
| 46 |
+
|
| 47 |
+
# Train on a single GPU
|
| 48 |
+
world_size: 1
|
| 49 |
+
gpu_ranks: [0]
|
| 50 |
+
|
| 51 |
+
# Batching 10240
|
| 52 |
+
batch_type: "tokens"
|
| 53 |
+
batch_size: 6000
|
| 54 |
+
valid_batch_size: 2048
|
| 55 |
+
batch_size_multiple: 8
|
| 56 |
+
accum_count: [20]
|
| 57 |
+
accum_steps: [0]
|
| 58 |
+
|
| 59 |
+
# Optimizer & Compute
|
| 60 |
+
compute_dtype: "fp16"
|
| 61 |
+
optim: "adamw"
|
| 62 |
+
#use_amp: False
|
| 63 |
+
learning_rate: 3.0
|
| 64 |
+
warmup_steps: 5000
|
| 65 |
+
decay_method: "noam"
|
| 66 |
+
adam_beta2: 0.998
|
| 67 |
+
|
| 68 |
+
# Data loading
|
| 69 |
+
bucket_size: 128000
|
| 70 |
+
num_workers: 4
|
| 71 |
+
prefetch_factor: 32
|
| 72 |
+
|
| 73 |
+
# Hyperparams
|
| 74 |
+
dropout_steps: [0]
|
| 75 |
+
dropout: [0.1]
|
| 76 |
+
attention_dropout: [0.1]
|
| 77 |
+
max_grad_norm: 0
|
| 78 |
+
label_smoothing: 0.1
|
| 79 |
+
average_decay: 0.0001
|
| 80 |
+
param_init_method: xavier_uniform
|
| 81 |
+
normalization: "tokens"
|
| 82 |
+
|
| 83 |
+
model:
|
| 84 |
+
architecture: "transformer"
|
| 85 |
+
share_embeddings: false
|
| 86 |
+
share_decoder_embeddings: true
|
| 87 |
+
hidden_size: 1024
|
| 88 |
+
encoder:
|
| 89 |
+
layers: 8
|
| 90 |
+
decoder:
|
| 91 |
+
layers: 2
|
| 92 |
+
heads: 8
|
| 93 |
+
transformer_ff: 4096
|
| 94 |
+
embeddings:
|
| 95 |
+
word_vec_size: 1024
|
| 96 |
+
position_encoding_type: "SinusoidalInterleaved"
|
| 97 |
+
|
README.md
CHANGED
|
@@ -1,3 +1,105 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- da
|
| 5 |
+
tags:
|
| 6 |
+
- translation
|
| 7 |
+
license: cc-by-4.0
|
| 8 |
+
datasets:
|
| 9 |
+
- quickmt/quickmt-train.da-en
|
| 10 |
+
model-index:
|
| 11 |
+
- name: quickmt-en-da
|
| 12 |
+
results:
|
| 13 |
+
- task:
|
| 14 |
+
name: Translation eng-dan
|
| 15 |
+
type: translation
|
| 16 |
+
args: eng-dan
|
| 17 |
+
dataset:
|
| 18 |
+
name: flores101-devtest
|
| 19 |
+
type: flores_101
|
| 20 |
+
args: eng_Latn dan_Latn devtest
|
| 21 |
+
metrics:
|
| 22 |
+
- name: BLEU
|
| 23 |
+
type: bleu
|
| 24 |
+
value: 46.61
|
| 25 |
+
- name: CHRF
|
| 26 |
+
type: chrf
|
| 27 |
+
value: 70.07
|
| 28 |
+
- name: COMET
|
| 29 |
+
type: comet
|
| 30 |
+
value: 89.49
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# `quickmt-en-da` Neural Machine Translation Model
|
| 35 |
+
|
| 36 |
+
`quickmt-en-da` is a reasonably fast and reasonably accurate neural machine translation model for translation from `en` into `da`.
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
## Try it on our Huggingface Space
|
| 40 |
+
|
| 41 |
+
Give it a try before downloading here: https://huggingface.co/spaces/quickmt/QuickMT-Demo
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
## Model Information
|
| 45 |
+
|
| 46 |
+
* Trained using [`eole`](https://github.com/eole-nlp/eole)
|
| 47 |
+
* 200M parameter transformer 'big' with 8 encoder layers and 2 decoder layers
|
| 48 |
+
* 32k separate Sentencepiece vocabs
|
| 49 |
+
* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format
|
| 50 |
+
|
| 51 |
+
See the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
## Usage with `quickmt`
|
| 55 |
+
|
| 56 |
+
You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
|
| 57 |
+
|
| 58 |
+
Next, install the `quickmt` python library and download the model:
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
git clone https://github.com/quickmt/quickmt.git
|
| 62 |
+
pip install ./quickmt/
|
| 63 |
+
|
| 64 |
+
quickmt-model-download quickmt/quickmt-en-da ./quickmt-en-da
|
| 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 |
+
t = Translator("./quickmt-en-da/", 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 |
+
t(sample_text, beam_size=5)
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
> 'Dr. Ehud Ur, professor i medicin ved Dalhousie University i Halifax, Nova Scotia og formand for den kliniske og videnskabelige afdeling af Canadian Diabetes Association advarede om, at forskningen stadig er i sine tidlige dage.'
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
# Get alternative translations by sampling
|
| 85 |
+
# You can pass any cTranslate2 `translate_batch` arguments
|
| 86 |
+
t([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
> 'Dr. Ehud Ur, professor i medicin på Dalhousie University i Halifax, Nova Scotia og formand for det kliniske og videnskabelige afdeling af Canadian Diabetes Association advarede om, at forskningen stadig er i sin tidlige dage.'
|
| 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 `eole` 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) ("eng_Latn"->"dan_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 the flores-devtest dataset (1012 sentences) on an Nvidia RTX 4070s GPU with batch size 32.
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
| | bleu | chrf2 | comet22 | Time (s) |
|
| 100 |
+
|:---------------------------------|-------:|--------:|----------:|-----------:|
|
| 101 |
+
| quickmt/quickmt-en-da | 46.61 | 70.07 | 89.49 | 1.19 |
|
| 102 |
+
| facebook/nllb-200-distilled-600M | 41.8 | 66.79 | 89.44 | 22.24 |
|
| 103 |
+
| facebook/nllb-200-distilled-1.3B | 44.02 | 68.52 | 90.73 | 39.32 |
|
| 104 |
+
| facebook/m2m100_418M | 36.81 | 62.93 | 85.35 | 18.97 |
|
| 105 |
+
| facebook/m2m100_1.2B | 44.54 | 68.46 | 89.43 | 37.42 |
|
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,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## IO
|
| 2 |
+
save_data: 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: da.eole.vocab
|
| 13 |
+
src_vocab_size: 32000
|
| 14 |
+
tgt_vocab_size: 32000
|
| 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.da-en/en
|
| 22 |
+
path_tgt: hf://quickmt/quickmt-train.da-en/da
|
| 23 |
+
path_sco: hf://quickmt/quickmt-train.da-en/sco
|
| 24 |
+
|
| 25 |
+
valid:
|
| 26 |
+
path_src: valid.en
|
| 27 |
+
path_tgt: valid.da
|
| 28 |
+
|
| 29 |
+
transforms: [sentencepiece, filtertoolong]
|
| 30 |
+
transforms_configs:
|
| 31 |
+
sentencepiece:
|
| 32 |
+
src_subword_model: "en.spm.model"
|
| 33 |
+
tgt_subword_model: "da.spm.model"
|
| 34 |
+
filtertoolong:
|
| 35 |
+
src_seq_length: 256
|
| 36 |
+
tgt_seq_length: 256
|
| 37 |
+
|
| 38 |
+
training:
|
| 39 |
+
# Run configuration
|
| 40 |
+
model_path: quickmt-en-da-eole-model
|
| 41 |
+
#train_from: model
|
| 42 |
+
keep_checkpoint: 4
|
| 43 |
+
train_steps: 100000
|
| 44 |
+
save_checkpoint_steps: 5000
|
| 45 |
+
valid_steps: 5000
|
| 46 |
+
|
| 47 |
+
# Train on a single GPU
|
| 48 |
+
world_size: 1
|
| 49 |
+
gpu_ranks: [0]
|
| 50 |
+
|
| 51 |
+
# Batching 10240
|
| 52 |
+
batch_type: "tokens"
|
| 53 |
+
batch_size: 6000
|
| 54 |
+
valid_batch_size: 2048
|
| 55 |
+
batch_size_multiple: 8
|
| 56 |
+
accum_count: [20]
|
| 57 |
+
accum_steps: [0]
|
| 58 |
+
|
| 59 |
+
# Optimizer & Compute
|
| 60 |
+
compute_dtype: "fp16"
|
| 61 |
+
optim: "adamw"
|
| 62 |
+
#use_amp: False
|
| 63 |
+
learning_rate: 3.0
|
| 64 |
+
warmup_steps: 5000
|
| 65 |
+
decay_method: "noam"
|
| 66 |
+
adam_beta2: 0.998
|
| 67 |
+
|
| 68 |
+
# Data loading
|
| 69 |
+
bucket_size: 128000
|
| 70 |
+
num_workers: 4
|
| 71 |
+
prefetch_factor: 32
|
| 72 |
+
|
| 73 |
+
# Hyperparams
|
| 74 |
+
dropout_steps: [0]
|
| 75 |
+
dropout: [0.1]
|
| 76 |
+
attention_dropout: [0.1]
|
| 77 |
+
max_grad_norm: 0
|
| 78 |
+
label_smoothing: 0.1
|
| 79 |
+
average_decay: 0.0001
|
| 80 |
+
param_init_method: xavier_uniform
|
| 81 |
+
normalization: "tokens"
|
| 82 |
+
|
| 83 |
+
model:
|
| 84 |
+
architecture: "transformer"
|
| 85 |
+
share_embeddings: false
|
| 86 |
+
share_decoder_embeddings: true
|
| 87 |
+
hidden_size: 1024
|
| 88 |
+
encoder:
|
| 89 |
+
layers: 8
|
| 90 |
+
decoder:
|
| 91 |
+
layers: 2
|
| 92 |
+
heads: 8
|
| 93 |
+
transformer_ff: 4096
|
| 94 |
+
embeddings:
|
| 95 |
+
word_vec_size: 1024
|
| 96 |
+
position_encoding_type: "SinusoidalInterleaved"
|
| 97 |
+
|
eole-model/config.json
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"src_vocab_size": 32000,
|
| 3 |
+
"tgt_vocab": "da.eole.vocab",
|
| 4 |
+
"report_every": 100,
|
| 5 |
+
"seed": 1234,
|
| 6 |
+
"tensorboard_log_dir_dated": "tensorboard/Nov-02_18-34-56",
|
| 7 |
+
"tgt_vocab_size": 32000,
|
| 8 |
+
"transforms": [
|
| 9 |
+
"sentencepiece",
|
| 10 |
+
"filtertoolong"
|
| 11 |
+
],
|
| 12 |
+
"n_sample": 0,
|
| 13 |
+
"save_data": "data",
|
| 14 |
+
"vocab_size_multiple": 8,
|
| 15 |
+
"share_vocab": false,
|
| 16 |
+
"tensorboard_log_dir": "tensorboard",
|
| 17 |
+
"valid_metrics": [
|
| 18 |
+
"BLEU"
|
| 19 |
+
],
|
| 20 |
+
"src_vocab": "en.eole.vocab",
|
| 21 |
+
"overwrite": true,
|
| 22 |
+
"tensorboard": true,
|
| 23 |
+
"training": {
|
| 24 |
+
"compute_dtype": "torch.float16",
|
| 25 |
+
"prefetch_factor": 32,
|
| 26 |
+
"batch_size": 6000,
|
| 27 |
+
"num_workers": 0,
|
| 28 |
+
"adam_beta2": 0.998,
|
| 29 |
+
"model_path": "quickmt-en-da-eole-model",
|
| 30 |
+
"label_smoothing": 0.1,
|
| 31 |
+
"learning_rate": 3.0,
|
| 32 |
+
"param_init_method": "xavier_uniform",
|
| 33 |
+
"bucket_size": 128000,
|
| 34 |
+
"world_size": 1,
|
| 35 |
+
"accum_count": [
|
| 36 |
+
20
|
| 37 |
+
],
|
| 38 |
+
"batch_size_multiple": 8,
|
| 39 |
+
"dropout_steps": [
|
| 40 |
+
0
|
| 41 |
+
],
|
| 42 |
+
"accum_steps": [
|
| 43 |
+
0
|
| 44 |
+
],
|
| 45 |
+
"decay_method": "noam",
|
| 46 |
+
"batch_type": "tokens",
|
| 47 |
+
"average_decay": 0.0001,
|
| 48 |
+
"normalization": "tokens",
|
| 49 |
+
"max_grad_norm": 0.0,
|
| 50 |
+
"train_steps": 100000,
|
| 51 |
+
"dropout": [
|
| 52 |
+
0.1
|
| 53 |
+
],
|
| 54 |
+
"gpu_ranks": [
|
| 55 |
+
0
|
| 56 |
+
],
|
| 57 |
+
"keep_checkpoint": 4,
|
| 58 |
+
"attention_dropout": [
|
| 59 |
+
0.1
|
| 60 |
+
],
|
| 61 |
+
"optim": "adamw",
|
| 62 |
+
"warmup_steps": 5000,
|
| 63 |
+
"save_checkpoint_steps": 5000,
|
| 64 |
+
"valid_batch_size": 2048,
|
| 65 |
+
"valid_steps": 5000
|
| 66 |
+
},
|
| 67 |
+
"model": {
|
| 68 |
+
"architecture": "transformer",
|
| 69 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 70 |
+
"share_decoder_embeddings": true,
|
| 71 |
+
"transformer_ff": 4096,
|
| 72 |
+
"share_embeddings": false,
|
| 73 |
+
"heads": 8,
|
| 74 |
+
"hidden_size": 1024,
|
| 75 |
+
"decoder": {
|
| 76 |
+
"decoder_type": "transformer",
|
| 77 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 78 |
+
"n_positions": null,
|
| 79 |
+
"transformer_ff": 4096,
|
| 80 |
+
"heads": 8,
|
| 81 |
+
"tgt_word_vec_size": 1024,
|
| 82 |
+
"layers": 2,
|
| 83 |
+
"hidden_size": 1024
|
| 84 |
+
},
|
| 85 |
+
"encoder": {
|
| 86 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 87 |
+
"n_positions": null,
|
| 88 |
+
"transformer_ff": 4096,
|
| 89 |
+
"heads": 8,
|
| 90 |
+
"src_word_vec_size": 1024,
|
| 91 |
+
"encoder_type": "transformer",
|
| 92 |
+
"layers": 8,
|
| 93 |
+
"hidden_size": 1024
|
| 94 |
+
},
|
| 95 |
+
"embeddings": {
|
| 96 |
+
"src_word_vec_size": 1024,
|
| 97 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 98 |
+
"tgt_word_vec_size": 1024,
|
| 99 |
+
"word_vec_size": 1024
|
| 100 |
+
}
|
| 101 |
+
},
|
| 102 |
+
"data": {
|
| 103 |
+
"corpus_1": {
|
| 104 |
+
"path_tgt": "train.da",
|
| 105 |
+
"path_src": "train.en",
|
| 106 |
+
"path_align": null,
|
| 107 |
+
"transforms": [
|
| 108 |
+
"sentencepiece",
|
| 109 |
+
"filtertoolong"
|
| 110 |
+
]
|
| 111 |
+
},
|
| 112 |
+
"valid": {
|
| 113 |
+
"path_tgt": "valid.da",
|
| 114 |
+
"path_src": "valid.en",
|
| 115 |
+
"path_align": null,
|
| 116 |
+
"transforms": [
|
| 117 |
+
"sentencepiece",
|
| 118 |
+
"filtertoolong"
|
| 119 |
+
]
|
| 120 |
+
}
|
| 121 |
+
},
|
| 122 |
+
"transforms_configs": {
|
| 123 |
+
"filtertoolong": {
|
| 124 |
+
"tgt_seq_length": 256,
|
| 125 |
+
"src_seq_length": 256
|
| 126 |
+
},
|
| 127 |
+
"sentencepiece": {
|
| 128 |
+
"tgt_subword_model": "${MODEL_PATH}/da.spm.model",
|
| 129 |
+
"src_subword_model": "${MODEL_PATH}/en.spm.model"
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
}
|
eole-model/da.spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:688ecf3cf51d2cf7497720ba36e5f3c6bdfea75630c2c2c8afcf8a0de3580d06
|
| 3 |
+
size 814697
|
eole-model/en.spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8eda8069d07624408f632a155bbfb6db9794b8bb7bdbc9040c8ec16d499b6ef2
|
| 3 |
+
size 800426
|
eole-model/model.00.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0efd749a46f05b8062f4a8d3535449b90a373e3b64d60b9240a2c541870c6dbb
|
| 3 |
+
size 840314816
|
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:dfdd52ec90e4661131251f5a8a15882c2774df6a7a9970c3298b1c938f5b9681
|
| 3 |
+
size 409915789
|
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:8eda8069d07624408f632a155bbfb6db9794b8bb7bdbc9040c8ec16d499b6ef2
|
| 3 |
+
size 800426
|
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:688ecf3cf51d2cf7497720ba36e5f3c6bdfea75630c2c2c8afcf8a0de3580d06
|
| 3 |
+
size 814697
|