Upload folder using huggingface_hub
Browse files- .ipynb_checkpoints/README-checkpoint.md +100 -0
- .ipynb_checkpoints/eole-config-checkpoint.yaml +104 -0
- README.md +100 -3
- config.json +10 -0
- eole-config.yaml +104 -0
- eole-model/ar.spm.model +3 -0
- eole-model/config.json +152 -0
- eole-model/en.spm.model +3 -0
- eole-model/model.00.safetensors +3 -0
- eole-model/optimizer.pt +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,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
README.md
CHANGED
|
@@ -1,3 +1,100 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.
|
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,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
eole-model/ar.spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c7b8bf117088a901628696f60ddd15e047057ccbdcf9b0996ca19e2779a234c7
|
| 3 |
+
size 642429
|
eole-model/config.json
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"src_vocab": "ar.eole.vocab",
|
| 3 |
+
"tensorboard_log_dir_dated": "tensorboard/Mar-21_20-28-42",
|
| 4 |
+
"tensorboard": true,
|
| 5 |
+
"valid_metrics": [
|
| 6 |
+
"BLEU"
|
| 7 |
+
],
|
| 8 |
+
"save_data": "ar-en/data",
|
| 9 |
+
"vocab_size_multiple": 8,
|
| 10 |
+
"share_vocab": false,
|
| 11 |
+
"tensorboard_log_dir": "tensorboard",
|
| 12 |
+
"tgt_vocab_size": 20000,
|
| 13 |
+
"src_vocab_size": 20000,
|
| 14 |
+
"report_every": 100,
|
| 15 |
+
"transforms": [
|
| 16 |
+
"sentencepiece",
|
| 17 |
+
"filtertoolong"
|
| 18 |
+
],
|
| 19 |
+
"seed": 1234,
|
| 20 |
+
"n_sample": 0,
|
| 21 |
+
"tgt_vocab": "en.eole.vocab",
|
| 22 |
+
"overwrite": true,
|
| 23 |
+
"training": {
|
| 24 |
+
"batch_size": 8192,
|
| 25 |
+
"batch_type": "tokens",
|
| 26 |
+
"valid_steps": 1000,
|
| 27 |
+
"decay_method": "noam",
|
| 28 |
+
"optim": "pagedadamw8bit",
|
| 29 |
+
"bucket_size": 128000,
|
| 30 |
+
"keep_checkpoint": 4,
|
| 31 |
+
"model_path": "model",
|
| 32 |
+
"label_smoothing": 0.1,
|
| 33 |
+
"batch_size_multiple": 8,
|
| 34 |
+
"param_init_method": "xavier_uniform",
|
| 35 |
+
"gpu_ranks": [
|
| 36 |
+
0
|
| 37 |
+
],
|
| 38 |
+
"warmup_steps": 5000,
|
| 39 |
+
"prefetch_factor": 32,
|
| 40 |
+
"dropout": [
|
| 41 |
+
0.1
|
| 42 |
+
],
|
| 43 |
+
"accum_steps": [
|
| 44 |
+
0
|
| 45 |
+
],
|
| 46 |
+
"world_size": 1,
|
| 47 |
+
"attention_dropout": [
|
| 48 |
+
0.0
|
| 49 |
+
],
|
| 50 |
+
"average_decay": 0.0001,
|
| 51 |
+
"max_grad_norm": 2.0,
|
| 52 |
+
"learning_rate": 2.0,
|
| 53 |
+
"normalization": "tokens",
|
| 54 |
+
"valid_batch_size": 8192,
|
| 55 |
+
"dropout_steps": [
|
| 56 |
+
0
|
| 57 |
+
],
|
| 58 |
+
"num_workers": 0,
|
| 59 |
+
"accum_count": [
|
| 60 |
+
16
|
| 61 |
+
],
|
| 62 |
+
"compute_dtype": "torch.float16",
|
| 63 |
+
"adam_beta2": 0.998,
|
| 64 |
+
"save_checkpoint_steps": 1000,
|
| 65 |
+
"train_steps": 200000,
|
| 66 |
+
"train_from": "model"
|
| 67 |
+
},
|
| 68 |
+
"transforms_configs": {
|
| 69 |
+
"filtertoolong": {
|
| 70 |
+
"tgt_seq_length": 256,
|
| 71 |
+
"src_seq_length": 256
|
| 72 |
+
},
|
| 73 |
+
"sentencepiece": {
|
| 74 |
+
"tgt_subword_model": "${MODEL_PATH}/en.spm.model",
|
| 75 |
+
"src_subword_alpha": 0.5,
|
| 76 |
+
"src_subword_nbest": -1,
|
| 77 |
+
"src_subword_model": "${MODEL_PATH}/ar.spm.model"
|
| 78 |
+
}
|
| 79 |
+
},
|
| 80 |
+
"model": {
|
| 81 |
+
"heads": 8,
|
| 82 |
+
"add_qkvbias": false,
|
| 83 |
+
"layer_norm": "standard",
|
| 84 |
+
"share_embeddings": false,
|
| 85 |
+
"share_decoder_embeddings": true,
|
| 86 |
+
"position_encoding_type": "SinusoidalInterleaved",
|
| 87 |
+
"architecture": "transformer",
|
| 88 |
+
"hidden_size": 1024,
|
| 89 |
+
"add_ffnbias": true,
|
| 90 |
+
"add_estimator": false,
|
| 91 |
+
"transformer_ff": 4096,
|
| 92 |
+
"norm_eps": 1e-06,
|
| 93 |
+
"mlp_activation_fn": "gelu",
|
| 94 |
+
"embeddings": {
|
| 95 |
+
"src_word_vec_size": 1024,
|
| 96 |
+
"tgt_word_vec_size": 1024,
|
| 97 |
+
"word_vec_size": 1024,
|
| 98 |
+
"position_encoding_type": "SinusoidalInterleaved"
|
| 99 |
+
},
|
| 100 |
+
"encoder": {
|
| 101 |
+
"heads": 8,
|
| 102 |
+
"transformer_ff": 4096,
|
| 103 |
+
"hidden_size": 1024,
|
| 104 |
+
"add_qkvbias": false,
|
| 105 |
+
"layer_norm": "standard",
|
| 106 |
+
"n_positions": null,
|
| 107 |
+
"add_ffnbias": true,
|
| 108 |
+
"encoder_type": "transformer",
|
| 109 |
+
"mlp_activation_fn": "gelu",
|
| 110 |
+
"layers": 8,
|
| 111 |
+
"src_word_vec_size": 1024,
|
| 112 |
+
"norm_eps": 1e-06,
|
| 113 |
+
"position_encoding_type": "SinusoidalInterleaved"
|
| 114 |
+
},
|
| 115 |
+
"decoder": {
|
| 116 |
+
"heads": 8,
|
| 117 |
+
"tgt_word_vec_size": 1024,
|
| 118 |
+
"transformer_ff": 4096,
|
| 119 |
+
"hidden_size": 1024,
|
| 120 |
+
"add_qkvbias": false,
|
| 121 |
+
"layer_norm": "standard",
|
| 122 |
+
"n_positions": null,
|
| 123 |
+
"add_ffnbias": true,
|
| 124 |
+
"decoder_type": "transformer",
|
| 125 |
+
"mlp_activation_fn": "gelu",
|
| 126 |
+
"layers": 2,
|
| 127 |
+
"norm_eps": 1e-06,
|
| 128 |
+
"position_encoding_type": "SinusoidalInterleaved"
|
| 129 |
+
}
|
| 130 |
+
},
|
| 131 |
+
"data": {
|
| 132 |
+
"corpus_1": {
|
| 133 |
+
"path_src": "hf://quickmt/quickmt-train.ar-en/ar",
|
| 134 |
+
"path_align": null,
|
| 135 |
+
"transforms": [
|
| 136 |
+
"sentencepiece",
|
| 137 |
+
"filtertoolong"
|
| 138 |
+
],
|
| 139 |
+
"path_tgt": "hf://quickmt/quickmt-train.ar-en/en",
|
| 140 |
+
"path_sco": "hf://quickmt/quickmt-train.ar-en/sco"
|
| 141 |
+
},
|
| 142 |
+
"valid": {
|
| 143 |
+
"path_src": "flores-dev.ar",
|
| 144 |
+
"path_tgt": "flores-dev.en",
|
| 145 |
+
"path_align": null,
|
| 146 |
+
"transforms": [
|
| 147 |
+
"sentencepiece",
|
| 148 |
+
"filtertoolong"
|
| 149 |
+
]
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
}
|
eole-model/en.spm.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:acf054421b5ed52bd6aee14564fb8595b9a6b492df669e971d43fba9edb33c16
|
| 3 |
+
size 589684
|
eole-model/model.00.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5529927ea7de80e3e4d2a39880dfdbdbd96801c1d46060e1649af9a3266b383
|
| 3 |
+
size 742170000
|
eole-model/optimizer.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e94d29cc8b319d940abae46c6e2f49d577b89849c9f79d783615cbac35edb0e
|
| 3 |
+
size 356768378
|
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:4a4210397c03c0ebddb84a0beaa39aa51dcaa5dce07dc04f63ec5e02bbc93911
|
| 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:c7b8bf117088a901628696f60ddd15e047057ccbdcf9b0996ca19e2779a234c7
|
| 3 |
+
size 642429
|
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:acf054421b5ed52bd6aee14564fb8595b9a6b492df669e971d43fba9edb33c16
|
| 3 |
+
size 589684
|