Upload folder using huggingface_hub
Browse filesFiles changed (14)
- .ipynb_checkpoints/README-checkpoint.mdAdded+101
- README.mdAdded+101
- config.jsonAdded+10
- eole-config.yamlAdded+97
- eole-model/config.jsonAdded+132
- eole-model/en.spm.modelAdded+3
- eole-model/it.spm.modelAdded+3
- eole-model/model.00.safetensorsAdded+3
- eole-model/vocab.jsonAdded
- model.binAdded+3
- source_vocabulary.jsonAdded
- src.spm.modelAdded+3
- target_vocabulary.jsonAdded
- tgt.spm.modelAdded+3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101---language:- en- ittags:- translationlicense: cc-by-4.0datasets:- quickmt/quickmt-train.it-enmodel-index:- name: quickmt-en-it results: - task: name: Translation eng-ita type: translation args: eng-ita dataset: name: flores101-devtest type: flores_101 args: eng_Latn ita_Latn devtest metrics: - name: BLEU type: bleu value: 30.52 - name: CHRF type: chrf value: 59.72 - name: COMET type: comet value: 87.55---
# `quickmt-en-it` Neural Machine Translation Model
`quickmt-en-it` is a reasonably fast and reasonably accurate neural machine translation model for translation from `en` into `it`.
## Model Information
* Trained using [`eole`](https://github.com/eole-nlp/eole)* 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers* 20k sentencepiece vocabularies* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.it-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-en-it ./quickmt-en-it```
Finally use the model in python:
```pythonfrom quickmt import Translator
# Auto-detects GPU, set to "cpu" to force CPU inferencet = Translator("./quickmt-en-it/", device="auto")
# Translate - set beam size to 5 for higher quality (but slower speed)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.'t(sample_text, beam_size=5)
> 'Il dottor Ehud Ur, professore di medicina alla Dalhousie University di Halifax, in Nuova Scozia e presidente della divisione clinica e scientifica della Canadian Diabetes Association, ha avvertito che la ricerca è ancora agli inizi.'
# 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)
> "Il Dott. Ehud Ur, professore di medicina alla Dalhousie University di Halifax, Nuova Scozia e presidente del dipartimento scientifico e clinica dell'Associazione Canada-del diabete ha avvertito che questa ricerca si trova ancora in pieno giorno."
```
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) ("eng_Latn"->"ita_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).
| | bleu | chrf2 | comet22 | Time (s) ||:---------------------------------|-------:|--------:|----------:|-----------:|| quickmt/quickmt-en-it | 30.52 | 59.72 | 87.55 | 1.06 || Helsink-NLP/opus-mt-en-it | 27.58 | 57.66 | 85.1 | 4.42 || facebook/nllb-200-distilled-600M | 28.58 | 58.3 | 87.3 | 24.93 || facebook/nllb-200-distilled-1.3B | 30.92 | 59.89 | 88.52 | 43.8 || facebook/m2m100_418M | 23.81 | 54.34 | 82.64 | 20.34 || facebook/m2m100_1.2B | 27.22 | 57.19 | 86.23 | 39.98 |
`quickmt-en-it` is the fastest and second highest quality next to `nllb-200-distilled-1.3B`.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101---language:- en- ittags:- translationlicense: cc-by-4.0datasets:- quickmt/quickmt-train.it-enmodel-index:- name: quickmt-en-it results: - task: name: Translation eng-ita type: translation args: eng-ita dataset: name: flores101-devtest type: flores_101 args: eng_Latn ita_Latn devtest metrics: - name: BLEU type: bleu value: 30.52 - name: CHRF type: chrf value: 59.72 - name: COMET type: comet value: 87.55---
# `quickmt-en-it` Neural Machine Translation Model
`quickmt-en-it` is a reasonably fast and reasonably accurate neural machine translation model for translation from `en` into `it`.
## Model Information
* Trained using [`eole`](https://github.com/eole-nlp/eole)* 185M parameter transformer 'big' with 8 encoder layers and 2 decoder layers* 20k sentencepiece vocabularies* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.it-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-en-it ./quickmt-en-it```
Finally use the model in python:
```pythonfrom quickmt import Translator
# Auto-detects GPU, set to "cpu" to force CPU inferencet = Translator("./quickmt-en-it/", device="auto")
# Translate - set beam size to 5 for higher quality (but slower speed)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.'t(sample_text, beam_size=5)
> 'Il dottor Ehud Ur, professore di medicina alla Dalhousie University di Halifax, in Nuova Scozia e presidente della divisione clinica e scientifica della Canadian Diabetes Association, ha avvertito che la ricerca è ancora agli inizi.'
# 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)
> "Il Dott. Ehud Ur, professore di medicina alla Dalhousie University di Halifax, Nuova Scozia e presidente del dipartimento scientifico e clinica dell'Associazione Canada-del diabete ha avvertito che questa ricerca si trova ancora in pieno giorno."
```
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) ("eng_Latn"->"ita_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).
| | bleu | chrf2 | comet22 | Time (s) ||:---------------------------------|-------:|--------:|----------:|-----------:|| quickmt/quickmt-en-it | 30.52 | 59.72 | 87.55 | 1.06 || Helsink-NLP/opus-mt-en-it | 27.58 | 57.66 | 85.1 | 4.42 || facebook/nllb-200-distilled-600M | 28.58 | 58.3 | 87.3 | 24.93 || facebook/nllb-200-distilled-1.3B | 30.92 | 59.89 | 88.52 | 43.8 || facebook/m2m100_418M | 23.81 | 54.34 | 82.64 | 20.34 || facebook/m2m100_1.2B | 27.22 | 57.19 | 86.23 | 39.98 |
`quickmt-en-it` is the fastest and second highest quality next to `nllb-200-distilled-1.3B`.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>"}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697## IOsave_data: dataoverwrite: Trueseed: 1234report_every: 100valid_metrics: ["BLEU"]tensorboard: truetensorboard_log_dir: tensorboard
### Vocabsrc_vocab: en.eole.vocabtgt_vocab: it.eole.vocabsrc_vocab_size: 20000tgt_vocab_size: 20000vocab_size_multiple: 8share_vocab: falsen_sample: 0
data: corpus_1: # path_src: hf://quickmt/quickmt-train.ja-en/ja # path_tgt: hf://quickmt/quickmt-train.ja-en/en # path_sco: hf://quickmt/quickmt-train.ja-en/sco path_src: train.en path_tgt: train.it valid: path_src: valid.en path_tgt: valid.it
transforms: [sentencepiece, filtertoolong]transforms_configs: sentencepiece: src_subword_model: "en.spm.model" tgt_subword_model: "it.spm.model" filtertoolong: src_seq_length: 256 tgt_seq_length: 256
training: # Run configuration model_path: quickmt-en-it-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" learning_rate: 2.0 warmup_steps: 4000 decay_method: "noam" adam_beta2: 0.998
# Data loading bucket_size: 512000 num_workers: 4 prefetch_factor: 64 # 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{ "src_vocab": "en.eole.vocab", "n_sample": 0, "seed": 1234, "tensorboard": true, "src_vocab_size": 20000, "vocab_size_multiple": 8, "tensorboard_log_dir_dated": "tensorboard/Apr-21_19-00-53", "tgt_vocab_size": 20000, "tensorboard_log_dir": "tensorboard", "share_vocab": false, "save_data": "data", "transforms": [ "sentencepiece", "filtertoolong" ], "valid_metrics": [ "BLEU" ], "tgt_vocab": "it.eole.vocab", "report_every": 100, "overwrite": true, "training": { "optim": "adamw", "average_decay": 0.0001, "keep_checkpoint": 4, "model_path": "quickmt-en-it-eole-model", "gpu_ranks": [ 0 ], "valid_steps": 5000, "batch_size": 8000, "bucket_size": 512000, "adam_beta2": 0.998, "label_smoothing": 0.1, "warmup_steps": 4000, "param_init_method": "xavier_uniform", "normalization": "tokens", "batch_type": "tokens", "save_checkpoint_steps": 5000, "num_workers": 0, "accum_count": [ 10 ], "train_steps": 100000, "dropout": [ 0.1 ], "learning_rate": 2.0, "max_grad_norm": 0.0, "attention_dropout": [ 0.1 ], "batch_size_multiple": 8, "prefetch_factor": 64, "compute_dtype": "torch.float16", "decay_method": "noam", "valid_batch_size": 4096, "world_size": 1, "accum_steps": [ 0 ], "dropout_steps": [ 0 ] }, "data": { "corpus_1": { "transforms": [ "sentencepiece", "filtertoolong" ], "path_tgt": "train.it", "path_align": null, "path_src": "train.en" }, "valid": { "transforms": [ "sentencepiece", "filtertoolong" ], "path_tgt": "valid.it", "path_align": null, "path_src": "valid.en" } }, "model": { "transformer_ff": 4096, "architecture": "transformer", "heads": 8, "share_embeddings": false, "hidden_size": 1024, "share_decoder_embeddings": false, "position_encoding_type": "SinusoidalInterleaved", "embeddings": { "position_encoding_type": "SinusoidalInterleaved", "src_word_vec_size": 1024, "tgt_word_vec_size": 1024, "word_vec_size": 1024 }, "decoder": { "tgt_word_vec_size": 1024, "layers": 2, "transformer_ff": 4096, "n_positions": null, "heads": 8, "decoder_type": "transformer", "hidden_size": 1024, "position_encoding_type": "SinusoidalInterleaved" }, "encoder": { "src_word_vec_size": 1024, "layers": 8, "transformer_ff": 4096, "n_positions": null, "encoder_type": "transformer", "heads": 8, "hidden_size": 1024, "position_encoding_type": "SinusoidalInterleaved" } }, "transforms_configs": { "filtertoolong": { "tgt_seq_length": 256, "src_seq_length": 256 }, "sentencepiece": { "src_subword_model": "${MODEL_PATH}/en.spm.model", "tgt_subword_model": "${MODEL_PATH}/it.spm.model" } }}123version https://git-lfs.github.com/spec/v1oid sha256:352edbef8a5896ac750aa1318696d770c15c85d79116c94b4872086a1de94b2dsize 586485123version https://git-lfs.github.com/spec/v1oid sha256:47b20d73c2224922ffef2d6f4bbe72810d7f75c80281dcea17515fc25a7a7bb9size 598389123version https://git-lfs.github.com/spec/v1oid sha256:1164a0b5ebb78a58e4e10563aeab594b3633d5e306c3e7e5760699984c0e9076size 823882912123version https://git-lfs.github.com/spec/v1oid sha256:def57a69faad1db092d1ac8ad7db1a9ee056e77625ab3dca0d2d1ac22d6c1f37size 401699775123version https://git-lfs.github.com/spec/v1oid sha256:352edbef8a5896ac750aa1318696d770c15c85d79116c94b4872086a1de94b2dsize 586485123version https://git-lfs.github.com/spec/v1oid sha256:47b20d73c2224922ffef2d6f4bbe72810d7f75c80281dcea17515fc25a7a7bb9size 598389.ipynb_checkpoints/README-checkpoint.mdAdded+101
README.mdAdded+101
config.jsonAdded+10
eole-config.yamlAdded+97
eole-model/config.jsonAdded+132
eole-model/en.spm.modelAdded+3
eole-model/it.spm.modelAdded+3
eole-model/model.00.safetensorsAdded+3
eole-model/vocab.jsonAdded
model.binAdded+3
source_vocabulary.jsonAdded
src.spm.modelAdded+3
target_vocabulary.jsonAdded
tgt.spm.modelAdded+3