Upload folder using huggingface_hub
Browse files- .ipynb_checkpoints/README-checkpoint.md +105 -0
- .ipynb_checkpoints/eole-config-checkpoint.yaml +95 -0
- README.md +105 -3
- config.json +10 -0
- eole-config.yaml +95 -0
- eole-model/config.json +132 -0
- eole-model/en.spm.model +3 -0
- eole-model/is.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 |
+
- is
|
| 5 |
+
tags:
|
| 6 |
+
- translation
|
| 7 |
+
license: cc-by-4.0
|
| 8 |
+
datasets:
|
| 9 |
+
- quickmt/quickmt-train.is-en
|
| 10 |
+
model-index:
|
| 11 |
+
- name: quickmt-en-is
|
| 12 |
+
results:
|
| 13 |
+
- task:
|
| 14 |
+
name: Translation eng-isl
|
| 15 |
+
type: translation
|
| 16 |
+
args: isl-eng
|
| 17 |
+
dataset:
|
| 18 |
+
name: flores101-devtest
|
| 19 |
+
type: flores_101
|
| 20 |
+
args: eng_Latn isl_Latn
|
| 21 |
+
metrics:
|
| 22 |
+
- name: BLEU
|
| 23 |
+
type: bleu
|
| 24 |
+
value: 25.85
|
| 25 |
+
- name: CHRF
|
| 26 |
+
type: chrf
|
| 27 |
+
value: 53.31
|
| 28 |
+
- name: COMET
|
| 29 |
+
type: comet
|
| 30 |
+
value: 80.89
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# `quickmt-en-is` Neural Machine Translation Model
|
| 35 |
+
|
| 36 |
+
`quickmt-en-is` is a reasonably fast and reasonably accurate neural machine translation model for translation from `en` into `is`.
|
| 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-is ./quickmt-en-is
|
| 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-is/", 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 |
+
> 'Ehud Ur, prófessor í læknisfræði við Dalhousie háskólann í Halifax, Nova Scotia og formaður klínískrar og vísindalegrar deildar kanadísku sykursýkisamtakanna varaði við því að rannsóknin væri enn á fyrstu dögum.'
|
| 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 |
+
> 'Ehud Ur, prófessor í lyflækninga við Dalhousie Háskólann í Halifax, Nova Scotia, og formaður klínískrar og vísindalegrar deildar kanadísku sykursýkisamtakanna varaði við því að rannsóknarinnar væri enn á frumdögum.'
|
| 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"->"isl_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 |
+
| | bleu | chrf2 | comet22 | Time (s) |
|
| 99 |
+
|:---------------------------------|-------:|--------:|----------:|-----------:|
|
| 100 |
+
| quickmt/quickmt-en-is | 25.85 | 53.31 | 80.89 | 1.75 |
|
| 101 |
+
| Helsinki-NLP/opus-mt-en-is | 18.57 | 46.63 | 76.47 | 3.93 |
|
| 102 |
+
| facebook/nllb-200-distilled-600M | 19.8 | 47.44 | 81.45 | 26.36 |
|
| 103 |
+
| facebook/nllb-200-distilled-1.3B | 23.04 | 50.93 | 84.15 | 46.58 |
|
| 104 |
+
| facebook/m2m100_418M | 11.93 | 37.46 | 63.74 | 22.54 |
|
| 105 |
+
| facebook/m2m100_1.2B | 17.52 | 45.25 | 77.38 | 45.06 |
|
.ipynb_checkpoints/eole-config-checkpoint.yaml
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: is.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.is-en/en
|
| 22 |
+
path_tgt: hf://quickmt/quickmt-train.is-en/is
|
| 23 |
+
path_sco: hf://quickmt/quickmt-train.is-en/sco
|
| 24 |
+
valid:
|
| 25 |
+
path_src: valid.en
|
| 26 |
+
path_tgt: valid.is
|
| 27 |
+
|
| 28 |
+
transforms: [sentencepiece, filtertoolong]
|
| 29 |
+
transforms_configs:
|
| 30 |
+
sentencepiece:
|
| 31 |
+
src_subword_model: "en.spm.model"
|
| 32 |
+
tgt_subword_model: "is.spm.model"
|
| 33 |
+
filtertoolong:
|
| 34 |
+
src_seq_length: 256
|
| 35 |
+
tgt_seq_length: 256
|
| 36 |
+
|
| 37 |
+
training:
|
| 38 |
+
# Run configuration
|
| 39 |
+
model_path: quickmt-en-is-eole-model
|
| 40 |
+
keep_checkpoint: 4
|
| 41 |
+
train_steps: 60000
|
| 42 |
+
save_checkpoint_steps: 5000
|
| 43 |
+
valid_steps: 5000
|
| 44 |
+
|
| 45 |
+
# Train on a single GPU
|
| 46 |
+
world_size: 1
|
| 47 |
+
gpu_ranks: [0]
|
| 48 |
+
|
| 49 |
+
# Batching 10240
|
| 50 |
+
batch_type: "tokens"
|
| 51 |
+
batch_size: 6000
|
| 52 |
+
valid_batch_size: 2048
|
| 53 |
+
batch_size_multiple: 8
|
| 54 |
+
accum_count: [20]
|
| 55 |
+
accum_steps: [0]
|
| 56 |
+
|
| 57 |
+
# Optimizer & Compute
|
| 58 |
+
compute_dtype: "fp16"
|
| 59 |
+
optim: "adamw"
|
| 60 |
+
#use_amp: False
|
| 61 |
+
learning_rate: 3.0
|
| 62 |
+
warmup_steps: 5000
|
| 63 |
+
decay_method: "noam"
|
| 64 |
+
adam_beta2: 0.998
|
| 65 |
+
|
| 66 |
+
# Data loading
|
| 67 |
+
bucket_size: 128000
|
| 68 |
+
num_workers: 4
|
| 69 |
+
prefetch_factor: 32
|
| 70 |
+
|
| 71 |
+
# Hyperparams
|
| 72 |
+
dropout_steps: [0]
|
| 73 |
+
dropout: [0.1]
|
| 74 |
+
attention_dropout: [0.1]
|
| 75 |
+
max_grad_norm: 0
|
| 76 |
+
label_smoothing: 0.1
|
| 77 |
+
average_decay: 0.0001
|
| 78 |
+
param_init_method: xavier_uniform
|
| 79 |
+
normalization: "tokens"
|
| 80 |
+
|
| 81 |
+
model:
|
| 82 |
+
architecture: "transformer"
|
| 83 |
+
share_embeddings: false
|
| 84 |
+
share_decoder_embeddings: true
|
| 85 |
+
hidden_size: 1024
|
| 86 |
+
encoder:
|
| 87 |
+
layers: 8
|
| 88 |
+
decoder:
|
| 89 |
+
layers: 2
|
| 90 |
+
heads: 8
|
| 91 |
+
transformer_ff: 4096
|
| 92 |
+
embeddings:
|
| 93 |
+
word_vec_size: 1024
|
| 94 |
+
position_encoding_type: "SinusoidalInterleaved"
|
| 95 |
+
|
README.md
CHANGED
|
@@ -1,3 +1,105 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- is
|
| 5 |
+
tags:
|
| 6 |
+
- translation
|
| 7 |
+
license: cc-by-4.0
|
| 8 |
+
datasets:
|
| 9 |
+
- quickmt/quickmt-train.is-en
|
| 10 |
+
model-index:
|
| 11 |
+
- name: quickmt-en-is
|
| 12 |
+
results:
|
| 13 |
+
- task:
|
| 14 |
+
name: Translation eng-isl
|
| 15 |
+
type: translation
|
| 16 |
+
args: isl-eng
|
| 17 |
+
dataset:
|
| 18 |
+
name: flores101-devtest
|
| 19 |
+
type: flores_101
|
| 20 |
+
args: eng_Latn isl_Latn
|
| 21 |
+
metrics:
|
| 22 |
+
- name: BLEU
|
| 23 |
+
type: bleu
|
| 24 |
+
value: 25.85
|
| 25 |
+
- name: CHRF
|
| 26 |
+
type: chrf
|
| 27 |
+
value: 53.31
|
| 28 |
+
- name: COMET
|
| 29 |
+
type: comet
|
| 30 |
+
value: 80.89
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# `quickmt-en-is` Neural Machine Translation Model
|
| 35 |
+
|
| 36 |
+
`quickmt-en-is` is a reasonably fast and reasonably accurate neural machine translation model for translation from `en` into `is`.
|
| 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-is ./quickmt-en-is
|
| 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-is/", 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 |
+
> 'Ehud Ur, prófessor í læknisfræði við Dalhousie háskólann í Halifax, Nova Scotia og formaður klínískrar og vísindalegrar deildar kanadísku sykursýkisamtakanna varaði við því að rannsóknin væri enn á fyrstu dögum.'
|
| 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 |
+
> 'Ehud Ur, prófessor í lyflækninga við Dalhousie Háskólann í Halifax, Nova Scotia, og formaður klínískrar og vísindalegrar deildar kanadísku sykursýkisamtakanna varaði við því að rannsóknarinnar væri enn á frumdögum.'
|
| 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"->"isl_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 |
+
| | bleu | chrf2 | comet22 | Time (s) |
|
| 99 |
+
|:---------------------------------|-------:|--------:|----------:|-----------:|
|
| 100 |
+
| quickmt/quickmt-en-is | 25.85 | 53.31 | 80.89 | 1.75 |
|
| 101 |
+
| Helsinki-NLP/opus-mt-en-is | 18.57 | 46.63 | 76.47 | 3.93 |
|
| 102 |
+
| facebook/nllb-200-distilled-600M | 19.8 | 47.44 | 81.45 | 26.36 |
|
| 103 |
+
| facebook/nllb-200-distilled-1.3B | 23.04 | 50.93 | 84.15 | 46.58 |
|
| 104 |
+
| facebook/m2m100_418M | 11.93 | 37.46 | 63.74 | 22.54 |
|
| 105 |
+
| facebook/m2m100_1.2B | 17.52 | 45.25 | 77.38 | 45.06 |
|
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,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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: is.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.is-en/en
|
| 22 |
+
path_tgt: hf://quickmt/quickmt-train.is-en/is
|
| 23 |
+
path_sco: hf://quickmt/quickmt-train.is-en/sco
|
| 24 |
+
valid:
|
| 25 |
+
path_src: valid.en
|
| 26 |
+
path_tgt: valid.is
|
| 27 |
+
|
| 28 |
+
transforms: [sentencepiece, filtertoolong]
|
| 29 |
+
transforms_configs:
|
| 30 |
+
sentencepiece:
|
| 31 |
+
src_subword_model: "en.spm.model"
|
| 32 |
+
tgt_subword_model: "is.spm.model"
|
| 33 |
+
filtertoolong:
|
| 34 |
+
src_seq_length: 256
|
| 35 |
+
tgt_seq_length: 256
|
| 36 |
+
|
| 37 |
+
training:
|
| 38 |
+
# Run configuration
|
| 39 |
+
model_path: quickmt-en-is-eole-model
|
| 40 |
+
keep_checkpoint: 4
|
| 41 |
+
train_steps: 60000
|
| 42 |
+
save_checkpoint_steps: 5000
|
| 43 |
+
valid_steps: 5000
|
| 44 |
+
|
| 45 |
+
# Train on a single GPU
|
| 46 |
+
world_size: 1
|
| 47 |
+
gpu_ranks: [0]
|
| 48 |
+
|
| 49 |
+
# Batching 10240
|
| 50 |
+
batch_type: "tokens"
|
| 51 |
+
batch_size: 6000
|
| 52 |
+
valid_batch_size: 2048
|
| 53 |
+
batch_size_multiple: 8
|
| 54 |
+
accum_count: [20]
|
| 55 |
+
accum_steps: [0]
|
| 56 |
+
|
| 57 |
+
# Optimizer & Compute
|
| 58 |
+
compute_dtype: "fp16"
|
| 59 |
+
optim: "adamw"
|
| 60 |
+
#use_amp: False
|
| 61 |
+
learning_rate: 3.0
|
| 62 |
+
warmup_steps: 5000
|
| 63 |
+
decay_method: "noam"
|
| 64 |
+
adam_beta2: 0.998
|
| 65 |
+
|
| 66 |
+
# Data loading
|
| 67 |
+
bucket_size: 128000
|
| 68 |
+
num_workers: 4
|
| 69 |
+
prefetch_factor: 32
|
| 70 |
+
|
| 71 |
+
# Hyperparams
|
| 72 |
+
dropout_steps: [0]
|
| 73 |
+
dropout: [0.1]
|
| 74 |
+
attention_dropout: [0.1]
|
| 75 |
+
max_grad_norm: 0
|
| 76 |
+
label_smoothing: 0.1
|
| 77 |
+
average_decay: 0.0001
|
| 78 |
+
param_init_method: xavier_uniform
|
| 79 |
+
normalization: "tokens"
|
| 80 |
+
|
| 81 |
+
model:
|
| 82 |
+
architecture: "transformer"
|
| 83 |
+
share_embeddings: false
|
| 84 |
+
share_decoder_embeddings: true
|
| 85 |
+
hidden_size: 1024
|
| 86 |
+
encoder:
|
| 87 |
+
layers: 8
|
| 88 |
+
decoder:
|
| 89 |
+
layers: 2
|
| 90 |
+
heads: 8
|
| 91 |
+
transformer_ff: 4096
|
| 92 |
+
embeddings:
|
| 93 |
+
word_vec_size: 1024
|
| 94 |
+
position_encoding_type: "SinusoidalInterleaved"
|
| 95 |
+
|
eole-model/config.json
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"vocab_size_multiple": 8,
|
| 3 |
+
"n_sample": 0,
|
| 4 |
+
"src_vocab": "en.eole.vocab",
|
| 5 |
+
"tgt_vocab_size": 32000,
|
| 6 |
+
"save_data": "data",
|
| 7 |
+
"tensorboard": true,
|
| 8 |
+
"tensorboard_log_dir": "tensorboard",
|
| 9 |
+
"overwrite": true,
|
| 10 |
+
"transforms": [
|
| 11 |
+
"sentencepiece",
|
| 12 |
+
"filtertoolong"
|
| 13 |
+
],
|
| 14 |
+
"report_every": 100,
|
| 15 |
+
"tensorboard_log_dir_dated": "tensorboard/Nov-18_22-06-12",
|
| 16 |
+
"seed": 1234,
|
| 17 |
+
"valid_metrics": [
|
| 18 |
+
"BLEU"
|
| 19 |
+
],
|
| 20 |
+
"tgt_vocab": "is.eole.vocab",
|
| 21 |
+
"share_vocab": false,
|
| 22 |
+
"src_vocab_size": 32000,
|
| 23 |
+
"training": {
|
| 24 |
+
"warmup_steps": 5000,
|
| 25 |
+
"attention_dropout": [
|
| 26 |
+
0.1
|
| 27 |
+
],
|
| 28 |
+
"prefetch_factor": 32,
|
| 29 |
+
"average_decay": 0.0001,
|
| 30 |
+
"accum_count": [
|
| 31 |
+
20
|
| 32 |
+
],
|
| 33 |
+
"gpu_ranks": [
|
| 34 |
+
0
|
| 35 |
+
],
|
| 36 |
+
"dropout_steps": [
|
| 37 |
+
0
|
| 38 |
+
],
|
| 39 |
+
"model_path": "quickmt-en-is-eole-model",
|
| 40 |
+
"accum_steps": [
|
| 41 |
+
0
|
| 42 |
+
],
|
| 43 |
+
"optim": "adamw",
|
| 44 |
+
"batch_size": 6000,
|
| 45 |
+
"keep_checkpoint": 4,
|
| 46 |
+
"save_checkpoint_steps": 5000,
|
| 47 |
+
"param_init_method": "xavier_uniform",
|
| 48 |
+
"batch_size_multiple": 8,
|
| 49 |
+
"world_size": 1,
|
| 50 |
+
"compute_dtype": "torch.float16",
|
| 51 |
+
"normalization": "tokens",
|
| 52 |
+
"decay_method": "noam",
|
| 53 |
+
"bucket_size": 128000,
|
| 54 |
+
"learning_rate": 3.0,
|
| 55 |
+
"valid_steps": 5000,
|
| 56 |
+
"max_grad_norm": 0.0,
|
| 57 |
+
"train_steps": 100000,
|
| 58 |
+
"adam_beta2": 0.998,
|
| 59 |
+
"num_workers": 0,
|
| 60 |
+
"dropout": [
|
| 61 |
+
0.1
|
| 62 |
+
],
|
| 63 |
+
"valid_batch_size": 2048,
|
| 64 |
+
"batch_type": "tokens",
|
| 65 |
+
"label_smoothing": 0.1
|
| 66 |
+
},
|
| 67 |
+
"data": {
|
| 68 |
+
"corpus_1": {
|
| 69 |
+
"path_src": "train_cefiltered5.en",
|
| 70 |
+
"path_tgt": "train_cefiltered5.is",
|
| 71 |
+
"transforms": [
|
| 72 |
+
"sentencepiece",
|
| 73 |
+
"filtertoolong"
|
| 74 |
+
],
|
| 75 |
+
"path_align": null
|
| 76 |
+
},
|
| 77 |
+
"valid": {
|
| 78 |
+
"path_src": "valid.en",
|
| 79 |
+
"path_tgt": "valid.is",
|
| 80 |
+
"transforms": [
|
| 81 |
+
"sentencepiece",
|
| 82 |
+
"filtertoolong"
|
| 83 |
+
],
|
| 84 |
+
"path_align": null
|
| 85 |
+
}
|
| 86 |
+
},
|
| 87 |
+
"transforms_configs": {
|
| 88 |
+
"sentencepiece": {
|
| 89 |
+
"tgt_subword_model": "${MODEL_PATH}/is.spm.model",
|
| 90 |
+
"src_subword_model": "${MODEL_PATH}/en.spm.model"
|
| 91 |
+
},
|
| 92 |
+
"filtertoolong": {
|
| 93 |
+
"tgt_seq_length": 256,
|
| 94 |
+
"src_seq_length": 256
|
| 95 |
+
}
|
| 96 |
+
},
|
| 97 |
+
"model": {
|
| 98 |
+
"hidden_size": 1024,
|
| 99 |
+
"share_decoder_embeddings": true,
|
| 100 |
+
"architecture": "transformer",
|
| 101 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 102 |
+
"heads": 8,
|
| 103 |
+
"share_embeddings": false,
|
| 104 |
+
"transformer_ff": 4096,
|
| 105 |
+
"encoder": {
|
| 106 |
+
"hidden_size": 1024,
|
| 107 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 108 |
+
"heads": 8,
|
| 109 |
+
"layers": 8,
|
| 110 |
+
"encoder_type": "transformer",
|
| 111 |
+
"src_word_vec_size": 1024,
|
| 112 |
+
"transformer_ff": 4096,
|
| 113 |
+
"n_positions": null
|
| 114 |
+
},
|
| 115 |
+
"embeddings": {
|
| 116 |
+
"src_word_vec_size": 1024,
|
| 117 |
+
"word_vec_size": 1024,
|
| 118 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 119 |
+
"tgt_word_vec_size": 1024
|
| 120 |
+
},
|
| 121 |
+
"decoder": {
|
| 122 |
+
"hidden_size": 1024,
|
| 123 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 124 |
+
"heads": 8,
|
| 125 |
+
"layers": 2,
|
| 126 |
+
"n_positions": null,
|
| 127 |
+
"decoder_type": "transformer",
|
| 128 |
+
"transformer_ff": 4096,
|
| 129 |
+
"tgt_word_vec_size": 1024
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
}
|
eole-model/en.spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ac985ba45c9ec783ae106ecde3c5873db2c14e4a1e76086e1eaf7d48295e9b0f
|
| 3 |
+
size 800209
|
eole-model/is.spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:538f374f5558509c152305b8efbea6cc87daa58cfd52dea3bb962c0ad908c797
|
| 3 |
+
size 814659
|
eole-model/model.00.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:31bb3f14756ff081a38f956d1cfaaec0ed520ddbec4536cb40aca0087a1a4e9d
|
| 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:c4bab03bb029b7e503b0aabd0ff6bde9051c21019e013847fab4d62d509cd0f8
|
| 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:ac985ba45c9ec783ae106ecde3c5873db2c14e4a1e76086e1eaf7d48295e9b0f
|
| 3 |
+
size 800209
|
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:538f374f5558509c152305b8efbea6cc87daa58cfd52dea3bb962c0ad908c797
|
| 3 |
+
size 814659
|