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+94
- eole-model/config.jsonAdded+132
- eole-model/en.spm.modelAdded+3
- eole-model/ja.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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100---language:- en- jatags:- translationlicense: cc-by-4.0datasets:- quickmt/quickmt-train.ja-enmodel-index:- name: quickmt-ja-en results: - task: name: Translation jpn-eng type: translation args: jpn-eng dataset: name: flores101-devtest type: flores_101 args: jpn_Japn eng_Latn devtest metrics: - name: CHRF type: chrf value: 57.06 - name: BLEU type: bleu value: 27.91 - name: COMET type: comet value: 87.29---
# `quickmt-ja-en` Neural Machine Translation Model
`quickmt-ja-en` is a reasonably fast and reasonably accurate neural machine translation model for translation from `ja` 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* 20k sentencepiece vocabularies* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.ja-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-ja-en ./quickmt-ja-en```
Finally use the model in python:
```pythonfrom quickmt import Translator
# Auto-detects GPU, set to "cpu" to force CPU inferencet = Translator("./quickmt-ja-en/", device="auto")
# Translate - set beam size to 5 for higher quality (but slower speed)sample_text = 'ノバスコシア州ハリファックスにあるダルハウジー大学医学部教授でカナダ糖尿病協会の臨床・科学部門の責任者を務めるエフード・ウル博士は、この研究はまだ初期段階にあるとして注意を促しました。't(sample_text, beam_size=5)
> 'Dr. Ehud Ulu, a professor of medicine at Dalhousie University in Halifax, Nova Scotia and head of the clinical and scientific division of the Canadian Diabetes Association, cautioned that the study is still in its early stages.'
# 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)
> 'Dr Ehud Ul, professor of medicine at the University of Dalhousie’s Halifax, Nova Scotia and head of the clinical and scientific division of the Canadian Diabetes Society, noted the study is in its early stages.'```
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) ("jpn_Jpan"->"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).
| | bleu | chrf2 | comet22 | Time (s) ||:---------------------------------|-------:|--------:|----------:|-----------:|| quickmt/quickmt-ja-en | 27.91 | 57.06 | 87.29 | 1.00 || Helsink-NLP/opus-mt-ja-en | 19.22 | 49.15 | 82.64 | 3.54 || facebook/nllb-200-distilled-600M | 24.05 | 53.39 | 85.84 | 22.5 || facebook/nllb-200-distilled-1.3B | 28.4 | 56.96 | 87.47 | 37.15 || facebook/m2m100_418M | 18.82 | 49.55 | 82.59 | 18.27 || facebook/m2m100_1.2B | 23.32 | 53.46 | 85.43 | 35.44 |
`quickmt-ja-en` is the fastest and nearly as high-quality as facebook/nllb-200-distilled-1.3B.123---license: cc-by-4.0---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100---language:- en- jatags:- translationlicense: cc-by-4.0datasets:- quickmt/quickmt-train.ja-enmodel-index:- name: quickmt-ja-enresults:- task:name: Translation jpn-engtype: translationargs: jpn-engdataset:name: flores101-devtesttype: flores_101args: jpn_Japn eng_Latn devtestmetrics:- name: CHRFtype: chrfvalue: 57.06- name: BLEUtype: bleuvalue: 27.91- name: COMETtype: cometvalue: 87.29---# `quickmt-ja-en` Neural Machine Translation Model`quickmt-ja-en` is a reasonably fast and reasonably accurate neural machine translation model for translation from `ja` 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* 20k sentencepiece vocabularies* Exported for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.ja-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-ja-en ./quickmt-ja-en```Finally use the model in python:```pythonfrom quickmt import Translator# Auto-detects GPU, set to "cpu" to force CPU inferencet = Translator("./quickmt-ja-en/", device="auto")# Translate - set beam size to 5 for higher quality (but slower speed)sample_text = 'ノバスコシア州ハリファックスにあるダルハウジー大学医学部教授でカナダ糖尿病協会の臨床・科学部門の責任者を務めるエフード・ウル博士は、この研究はまだ初期段階にあるとして注意を促しました。't(sample_text, beam_size=5)> 'Dr. Ehud Ulu, a professor of medicine at Dalhousie University in Halifax, Nova Scotia and head of the clinical and scientific division of the Canadian Diabetes Association, cautioned that the study is still in its early stages.'# 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)> 'Dr Ehud Ul, professor of medicine at the University of Dalhousie’s Halifax, Nova Scotia and head of the clinical and scientific division of the Canadian Diabetes Society, noted the study is in its early stages.'```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) ("jpn_Jpan"->"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).| | bleu | chrf2 | comet22 | Time (s) ||:---------------------------------|-------:|--------:|----------:|-----------:|| quickmt/quickmt-ja-en | 27.91 | 57.06 | 87.29 | 1.00 || Helsink-NLP/opus-mt-ja-en | 19.22 | 49.15 | 82.64 | 3.54 || facebook/nllb-200-distilled-600M | 24.05 | 53.39 | 85.84 | 22.5 || facebook/nllb-200-distilled-1.3B | 28.4 | 56.96 | 87.47 | 37.15 || facebook/m2m100_418M | 18.82 | 49.55 | 82.59 | 18.27 || facebook/m2m100_1.2B | 23.32 | 53.46 | 85.43 | 35.44 |`quickmt-ja-en` is the fastest and nearly as high-quality as facebook/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>"}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394## IOsave_data: dataoverwrite: Trueseed: 1234report_every: 100valid_metrics: ["BLEU"]tensorboard: truetensorboard_log_dir: tensorboard
### Vocabsrc_vocab: ja.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.ja-en/ja path_tgt: hf://quickmt/quickmt-train.ja-en/en path_sco: hf://quickmt/quickmt-train.ja-en/sco valid: path_src: valid.ja path_tgt: valid.en
transforms: [sentencepiece, filtertoolong]transforms_configs: sentencepiece: src_subword_model: "ja.spm.model" tgt_subword_model: "en.spm.model" filtertoolong: src_seq_length: 256 tgt_seq_length: 256
training: # Run configuration model_path: eole-model keep_checkpoint: 4 train_steps: 108000 save_checkpoint_steps: 2000 valid_steps: 2000 # 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: [8] 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: 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{ "n_sample": 0, "overwrite": true, "save_data": "data", "tgt_vocab_size": 20000, "seed": 1234, "share_vocab": false, "tensorboard_log_dir": "tensorboard", "report_every": 100, "tensorboard": true, "tgt_vocab": "en.eole.vocab", "vocab_size_multiple": 8, "src_vocab": "ja.eole.vocab", "src_vocab_size": 20000, "tensorboard_log_dir_dated": "tensorboard/Apr-15_05-55-59", "transforms": [ "sentencepiece", "filtertoolong" ], "valid_metrics": [ "BLEU" ], "training": { "save_checkpoint_steps": 2000, "max_grad_norm": 0.0, "dropout": [ 0.1 ], "dropout_steps": [ 0 ], "label_smoothing": 0.1, "keep_checkpoint": 4, "prefetch_factor": 32, "valid_steps": 2000, "optim": "adamw", "gpu_ranks": [ 0 ], "bucket_size": 128000, "batch_size": 8000, "average_decay": 0.0001, "compute_dtype": "torch.float16", "param_init_method": "xavier_uniform", "decay_method": "noam", "num_workers": 0, "warmup_steps": 4000, "attention_dropout": [ 0.1 ], "model_path": "quickmt-ja-en-eole-model", "accum_count": [ 8 ], "batch_size_multiple": 8, "train_steps": 200000, "accum_steps": [ 0 ], "adam_beta2": 0.998, "learning_rate": 2.0, "normalization": "tokens", "valid_batch_size": 4096, "world_size": 1, "batch_type": "tokens" }, "model": { "transformer_ff": 4096, "share_decoder_embeddings": false, "architecture": "transformer", "position_encoding_type": "SinusoidalInterleaved", "share_embeddings": false, "heads": 8, "hidden_size": 1024, "encoder": { "layers": 8, "transformer_ff": 4096, "position_encoding_type": "SinusoidalInterleaved", "src_word_vec_size": 1024, "n_positions": null, "encoder_type": "transformer", "heads": 8, "hidden_size": 1024 }, "embeddings": { "tgt_word_vec_size": 1024, "position_encoding_type": "SinusoidalInterleaved", "word_vec_size": 1024, "src_word_vec_size": 1024 }, "decoder": { "layers": 2, "transformer_ff": 4096, "position_encoding_type": "SinusoidalInterleaved", "n_positions": null, "decoder_type": "transformer", "tgt_word_vec_size": 1024, "heads": 8, "hidden_size": 1024 } }, "transforms_configs": { "sentencepiece": { "src_subword_model": "${MODEL_PATH}/ja.spm.model", "tgt_subword_model": "${MODEL_PATH}/en.spm.model" }, "filtertoolong": { "tgt_seq_length": 256, "src_seq_length": 256 } }, "data": { "corpus_1": { "path_tgt": "en.txt", "path_align": null, "transforms": [ "sentencepiece", "filtertoolong" ], "path_src": "ja.txt" }, "valid": { "path_tgt": "valid.en", "path_align": null, "transforms": [ "sentencepiece", "filtertoolong" ], "path_src": "valid.ja" } }}123version https://git-lfs.github.com/spec/v1oid sha256:01dc857df9df5987bec61812d1fbc2e78ad530346c09fe3ffaf27184358ab8fdsize 583983123version https://git-lfs.github.com/spec/v1oid sha256:cbd449d7e92d850f6d36efeafb40cea3a8468f55db0ca751ee4ece0ceb70d19bsize 583133123version https://git-lfs.github.com/spec/v1oid sha256:f226e709170b27c12510b5b186f305fcc9ddb3dbf4ae3ea1066f8ff4632f7de1size 823882912123version https://git-lfs.github.com/spec/v1oid sha256:4f9906f44709dab21e2bd168cb19e4379326d4b8e92513dc9b4e5ff4af6cf323size 401699775123version https://git-lfs.github.com/spec/v1oid sha256:cbd449d7e92d850f6d36efeafb40cea3a8468f55db0ca751ee4ece0ceb70d19bsize 583133123version https://git-lfs.github.com/spec/v1oid sha256:01dc857df9df5987bec61812d1fbc2e78ad530346c09fe3ffaf27184358ab8fdsize 583983.ipynb_checkpoints/README-checkpoint.mdAdded+100
README.md+100-3
config.jsonAdded+10
eole-config.yamlAdded+94
eole-model/config.jsonAdded+132
eole-model/en.spm.modelAdded+3
eole-model/ja.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