Upload folder using huggingface_hub
Browse filesFiles changed (14)
- .ipynb_checkpoints/README-checkpoint.mdAdded+100
- README.md+100-3
- config.jsonAdded+10
- eole-config.yamlAdded+98
- eole-model/config.jsonAdded+132
- eole-model/en.spm.modelAdded+3
- eole-model/model.00.safetensorsAdded+3
- eole-model/ru.spm.modelAdded+3
- eole-model/vocab.jsonAdded
- model.binAdded+3
- source_vocabulary.jsonAdded
- src.spm.modelAdded+3
- target_vocabulary.jsonAdded
- tgt.spm.modelAdded+3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100---language:- en- rutags:- translationlicense: cc-by-4.0datasets:- quickmt/quickmt-train.ru-enmodel-index:- name: quickmt-ru-en results: - task: name: Translation rus-eng type: translation args: rus-eng dataset: name: flores101-devtest type: flores_101 args: rus_Cyrl eng_Latn devtest metrics: - name: BLEU type: bleu value: 33.9 - name: CHRF type: chrf value: 61.63 - name: COMET type: comet value: 85.7---
# `quickmt-ru-en` Neural Machine Translation Model
`quickmt-ru-en` is a reasonably fast and reasonably accurate neural machine translation model for translation from `ru` into `en`.
## Model Information
* Trained using [`eole`](https://github.com/eole-nlp/eole)* 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers* 50k joint Sentencepiece vocabulary* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.ru-en/tree/main
See the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.
## Usage with `quickmt`
You must install the Nvidia cuda toolkit first, if you want to do GPU inference.
Next, install the `quickmt` python library and download the model:
```bashgit clone https://github.com/quickmt/quickmt.gitpip install ./quickmt/
quickmt-model-download quickmt/quickmt-ru-en ./quickmt-ru-en```
Finally use the model in python:
```pythonfrom quickmt import Translator
# Auto-detects GPU, set to "cpu" to force CPU inferencet = Translator("./quickmt-ru-en/", device="auto")
# Translate - set beam size to 1 for faster speed (but lower quality)sample_text = 'Согласно предупреждению доктора Эхуда Ура (Ehud Ur), профессора медицины в Университете Дэлхаузи в Галифаксе (Новая Шотландия) и председателя клинико-научного отдела Канадской диабетической ассоциации, исследования все еще находятся на начальной стадии.'
t(sample_text, beam_size=5)```
> 'According to the warning of Dr. Ehud Ur, Professor of Medicine at Dalhousie University in Halifax, Nova Scotia, and Chair of the Clinical Science Division of the Canadian Diabetes Association, the research is still in its infancy.'
```python# Get alternative translations by sampling# You can pass any cTranslate2 `translate_batch` argumentst([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)```
> 'According to the warning of Professor Ehud Ur, a Professor of Medicine at Dalhousie University in Halifax, Nova Scotia, and Chair of the Clinical and Scientific Division of the Canadian Diabetes Association, research is still in a very early stage.'
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`.
## Metrics
`bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores) ("rus_Cyrl"->"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 the flores-devtest dataset (1012 sentences) on an RTX 4070s GPU with batch size 32 (faster speed is possible using a larger batch size).
| | bleu | chrf2 | comet22 | Time (s) ||:---------------------------------|-------:|--------:|----------:|-----------:|| quickmt/quickmt-ru-en | 33.9 | 61.63 | 85.7 | 1.31 || Helsink-NLP/opus-mt-ru-en | 30.04 | 58.23 | 83.97 | 3.72 || facebook/nllb-200-distilled-600M | 34.59 | 61.26 | 85.88 | 21.93 || facebook/nllb-200-distilled-1.3B | 36.99 | 63.04 | 86.59 | 38.12 || facebook/m2m100_418M | 26.62 | 56.31 | 81.77 | 18.73 || facebook/m2m100_1.2B | 32.01 | 60.3 | 85.01 | 35.99 |123---license: cc-by-4.0---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100---language:- en- rutags:- translationlicense: cc-by-4.0datasets:- quickmt/quickmt-train.ru-enmodel-index:- name: quickmt-ru-enresults:- task:name: Translation rus-engtype: translationargs: rus-engdataset:name: flores101-devtesttype: flores_101args: rus_Cyrl eng_Latn devtestmetrics:- name: BLEUtype: bleuvalue: 33.9- name: CHRFtype: chrfvalue: 61.63- name: COMETtype: cometvalue: 85.7---# `quickmt-ru-en` Neural Machine Translation Model`quickmt-ru-en` is a reasonably fast and reasonably accurate neural machine translation model for translation from `ru` into `en`.## Model Information* Trained using [`eole`](https://github.com/eole-nlp/eole)* 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers* 50k joint Sentencepiece vocabulary* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.ru-en/tree/mainSee the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.## Usage with `quickmt`You must install the Nvidia cuda toolkit first, if you want to do GPU inference.Next, install the `quickmt` python library and download the model:```bashgit clone https://github.com/quickmt/quickmt.gitpip install ./quickmt/quickmt-model-download quickmt/quickmt-ru-en ./quickmt-ru-en```Finally use the model in python:```pythonfrom quickmt import Translator# Auto-detects GPU, set to "cpu" to force CPU inferencet = Translator("./quickmt-ru-en/", device="auto")# Translate - set beam size to 1 for faster speed (but lower quality)sample_text = 'Согласно предупреждению доктора Эхуда Ура (Ehud Ur), профессора медицины в Университете Дэлхаузи в Галифаксе (Новая Шотландия) и председателя клинико-научного отдела Канадской диабетической ассоциации, исследования все еще находятся на начальной стадии.'t(sample_text, beam_size=5)```> 'According to the warning of Dr. Ehud Ur, Professor of Medicine at Dalhousie University in Halifax, Nova Scotia, and Chair of the Clinical Science Division of the Canadian Diabetes Association, the research is still in its infancy.'```python# Get alternative translations by sampling# You can pass any cTranslate2 `translate_batch` argumentst([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)```> 'According to the warning of Professor Ehud Ur, a Professor of Medicine at Dalhousie University in Halifax, Nova Scotia, and Chair of the Clinical and Scientific Division of the Canadian Diabetes Association, research is still in a very early stage.'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`.## Metrics`bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores) ("rus_Cyrl"->"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 the flores-devtest dataset (1012 sentences) on an RTX 4070s GPU with batch size 32 (faster speed is possible using a larger batch size).| | bleu | chrf2 | comet22 | Time (s) ||:---------------------------------|-------:|--------:|----------:|-----------:|| quickmt/quickmt-ru-en | 33.9 | 61.63 | 85.7 | 1.31 || Helsink-NLP/opus-mt-ru-en | 30.04 | 58.23 | 83.97 | 3.72 || facebook/nllb-200-distilled-600M | 34.59 | 61.26 | 85.88 | 21.93 || facebook/nllb-200-distilled-1.3B | 36.99 | 63.04 | 86.59 | 38.12 || facebook/m2m100_418M | 26.62 | 56.31 | 81.77 | 18.73 || facebook/m2m100_1.2B | 32.01 | 60.3 | 85.01 | 35.99 |
12345678910{ "add_source_bos": false, "add_source_eos": false, "bos_token": "<s>", "decoder_start_token": "<s>", "eos_token": "</s>", "layer_norm_epsilon": 1e-06, "multi_query_attention": false, "unk_token": "<unk>"}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798## IOsave_data: dataoverwrite: Trueseed: 1234report_every: 100valid_metrics: ["BLEU"]tensorboard: truetensorboard_log_dir: tensorboard
### Vocabsrc_vocab: ru.eole.vocabtgt_vocab: en.eole.vocabsrc_vocab_size: 20000tgt_vocab_size: 20000vocab_size_multiple: 8share_vocab: falsen_sample: 0
data: corpus_1: # path_src: hf://quickmt/quickmt-train.ru-en/ru # path_tgt: hf://quickmt/quickmt-train.ru-en/en # path_sco: hf://quickmt/quickmt-train.ru-en/sco path_src: train.ru path_tgt: train.en valid: path_src: dev.ru path_tgt: dev.en
transforms: [sentencepiece, filtertoolong]transforms_configs: sentencepiece: src_subword_model: "ru.spm.model" tgt_subword_model: "en.spm.model" filtertoolong: src_seq_length: 256 tgt_seq_length: 256
training: # Run configuration model_path: quickmt-ru-en-eole-model #train_from: model keep_checkpoint: 4 train_steps: 100000 save_checkpoint_steps: 5000 valid_steps: 5000 # Train on a single GPU world_size: 1 gpu_ranks: [0]
# Batching 10240 batch_type: "tokens" batch_size: 8000 valid_batch_size: 4096 batch_size_multiple: 8 accum_count: [10] accum_steps: [0]
# Optimizer & Compute compute_dtype: "fp16" optim: "adamw" #use_amp: False learning_rate: 2.0 warmup_steps: 4000 decay_method: "noam" adam_beta2: 0.998
# Data loading bucket_size: 128000 num_workers: 4 prefetch_factor: 32 # Hyperparams dropout_steps: [0] dropout: [0.1] attention_dropout: [0.1] max_grad_norm: 0 label_smoothing: 0.1 average_decay: 0.0001 param_init_method: xavier_uniform normalization: "tokens"
model: architecture: "transformer" share_embeddings: false share_decoder_embeddings: false hidden_size: 1024 encoder: layers: 8 decoder: layers: 2 heads: 8 transformer_ff: 4096 embeddings: word_vec_size: 1024 position_encoding_type: "SinusoidalInterleaved"
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132{ "report_every": 100, "tgt_vocab": "en.eole.vocab", "valid_metrics": [ "BLEU" ], "tensorboard": true, "src_vocab": "ru.eole.vocab", "transforms": [ "sentencepiece", "filtertoolong" ], "vocab_size_multiple": 8, "tensorboard_log_dir": "tensorboard", "seed": 1234, "n_sample": 0, "save_data": "data", "share_vocab": false, "src_vocab_size": 20000, "tensorboard_log_dir_dated": "tensorboard/May-06_17-28-49", "tgt_vocab_size": 20000, "overwrite": true, "training": { "bucket_size": 128000, "dropout_steps": [ 0 ], "keep_checkpoint": 4, "average_decay": 0.0001, "param_init_method": "xavier_uniform", "attention_dropout": [ 0.1 ], "train_steps": 100000, "batch_size": 8000, "accum_steps": [ 0 ], "prefetch_factor": 32, "max_grad_norm": 0.0, "valid_batch_size": 4096, "dropout": [ 0.1 ], "num_workers": 0, "decay_method": "noam", "valid_steps": 5000, "model_path": "quickmt-ru-en-eole-model", "world_size": 1, "learning_rate": 2.0, "save_checkpoint_steps": 5000, "optim": "adamw", "normalization": "tokens", "adam_beta2": 0.998, "warmup_steps": 4000, "batch_size_multiple": 8, "label_smoothing": 0.1, "compute_dtype": "torch.float16", "gpu_ranks": [ 0 ], "accum_count": [ 10 ], "batch_type": "tokens" }, "model": { "transformer_ff": 4096, "architecture": "transformer", "hidden_size": 1024, "share_decoder_embeddings": false, "position_encoding_type": "SinusoidalInterleaved", "heads": 8, "share_embeddings": false, "embeddings": { "src_word_vec_size": 1024, "position_encoding_type": "SinusoidalInterleaved", "tgt_word_vec_size": 1024, "word_vec_size": 1024 }, "encoder": { "transformer_ff": 4096, "hidden_size": 1024, "layers": 8, "position_encoding_type": "SinusoidalInterleaved", "encoder_type": "transformer", "src_word_vec_size": 1024, "heads": 8, "n_positions": null }, "decoder": { "transformer_ff": 4096, "tgt_word_vec_size": 1024, "decoder_type": "transformer", "hidden_size": 1024, "layers": 2, "position_encoding_type": "SinusoidalInterleaved", "heads": 8, "n_positions": null } }, "transforms_configs": { "filtertoolong": { "tgt_seq_length": 256, "src_seq_length": 256 }, "sentencepiece": { "tgt_subword_model": "${MODEL_PATH}/en.spm.model", "src_subword_model": "${MODEL_PATH}/ru.spm.model" } }, "data": { "corpus_1": { "path_src": "train.ru", "transforms": [ "sentencepiece", "filtertoolong" ], "path_align": null, "path_tgt": "train.en" }, "valid": { "path_src": "dev.ru", "transforms": [ "sentencepiece", "filtertoolong" ], "path_align": null, "path_tgt": "dev.en" } }}123version https://git-lfs.github.com/spec/v1oid sha256:a02eda49b9085bb516903b522f5123f22a730b2be29337202ff8280b786a680esize 592273123version https://git-lfs.github.com/spec/v1oid sha256:8b26000560eac8419c39aa672d130421a03ef65a60bd66818bfeeea152f0799dsize 823882912123version https://git-lfs.github.com/spec/v1oid sha256:b428315194a0eebf6e69c4424ea2e78a1c03e20982eccd4e6eb446ca128124ecsize 730304123version https://git-lfs.github.com/spec/v1oid sha256:0fb552c7074a60314b7d411a3f533320d79f1236c05534a2dc8e926888af24bdsize 401699775123version https://git-lfs.github.com/spec/v1oid sha256:b428315194a0eebf6e69c4424ea2e78a1c03e20982eccd4e6eb446ca128124ecsize 730304123version https://git-lfs.github.com/spec/v1oid sha256:a02eda49b9085bb516903b522f5123f22a730b2be29337202ff8280b786a680esize 592273.ipynb_checkpoints/README-checkpoint.mdAdded+100
README.md+100-3
config.jsonAdded+10
eole-config.yamlAdded+98
eole-model/config.jsonAdded+132
eole-model/en.spm.modelAdded+3
eole-model/model.00.safetensorsAdded+3
eole-model/ru.spm.modelAdded+3
eole-model/vocab.jsonAdded
model.binAdded+3
source_vocabulary.jsonAdded
src.spm.modelAdded+3
target_vocabulary.jsonAdded
tgt.spm.modelAdded+3