Upload 10 files
Browse files- .gitattributes +8 -27
- README.md +111 -0
- config.json +57 -0
- flax_model.msgpack +3 -0
- generation_config.json +12 -0
- pytorch_model.bin +3 -0
- sentencepiece.bpe.model +3 -0
- special_tokens_map.json +1 -0
- tf_model.h5 +3 -0
- tokenizer_config.json +1 -0
.gitattributes
CHANGED
@@ -1,35 +1,16 @@
|
|
1 |
-
*.
|
2 |
-
*.
|
3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
1 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
4 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
11 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
12 |
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
14 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
15 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
16 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- multilingual
|
4 |
+
- ar
|
5 |
+
- cs
|
6 |
+
- de
|
7 |
+
- en
|
8 |
+
- es
|
9 |
+
- et
|
10 |
+
- fi
|
11 |
+
- fr
|
12 |
+
- gu
|
13 |
+
- hi
|
14 |
+
- it
|
15 |
+
- ja
|
16 |
+
- kk
|
17 |
+
- ko
|
18 |
+
- lt
|
19 |
+
- lv
|
20 |
+
- my
|
21 |
+
- ne
|
22 |
+
- nl
|
23 |
+
- ro
|
24 |
+
- ru
|
25 |
+
- si
|
26 |
+
- tr
|
27 |
+
- vi
|
28 |
+
- zh
|
29 |
+
- af
|
30 |
+
- az
|
31 |
+
- bn
|
32 |
+
- fa
|
33 |
+
- he
|
34 |
+
- hr
|
35 |
+
- id
|
36 |
+
- ka
|
37 |
+
- km
|
38 |
+
- mk
|
39 |
+
- ml
|
40 |
+
- mn
|
41 |
+
- mr
|
42 |
+
- pl
|
43 |
+
- ps
|
44 |
+
- pt
|
45 |
+
- sv
|
46 |
+
- sw
|
47 |
+
- ta
|
48 |
+
- te
|
49 |
+
- th
|
50 |
+
- tl
|
51 |
+
- uk
|
52 |
+
- ur
|
53 |
+
- xh
|
54 |
+
- gl
|
55 |
+
- sl
|
56 |
+
tags:
|
57 |
+
- mbart-50
|
58 |
+
---
|
59 |
+
|
60 |
+
# mBART-50 one to many multilingual machine translation
|
61 |
+
|
62 |
+
|
63 |
+
This model is a fine-tuned checkpoint of [mBART-large-50](https://huggingface.co/facebook/mbart-large-50). `mbart-large-50-one-to-many-mmt` is fine-tuned for multilingual machine translation. It was introduced in [Multilingual Translation with Extensible Multilingual Pretraining and Finetuning](https://arxiv.org/abs/2008.00401) paper.
|
64 |
+
|
65 |
+
|
66 |
+
The model can translate English to other 49 languages mentioned below.
|
67 |
+
To translate into a target language, the target language id is forced as the first generated token. To force the
|
68 |
+
target language id as the first generated token, pass the `forced_bos_token_id` parameter to the `generate` method.
|
69 |
+
|
70 |
+
```python
|
71 |
+
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
72 |
+
article_en = "The head of the United Nations says there is no military solution in Syria"
|
73 |
+
model = MBartForConditionalGeneration.from_pretrained("facebook/mbart-large-50-one-to-many-mmt")
|
74 |
+
tokenizer = MBart50TokenizerFast.from_pretrained("facebook/mbart-large-50-one-to-many-mmt", src_lang="en_XX")
|
75 |
+
|
76 |
+
model_inputs = tokenizer(article_en, return_tensors="pt")
|
77 |
+
|
78 |
+
# translate from English to Hindi
|
79 |
+
generated_tokens = model.generate(
|
80 |
+
**model_inputs,
|
81 |
+
forced_bos_token_id=tokenizer.lang_code_to_id["hi_IN"]
|
82 |
+
)
|
83 |
+
tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
84 |
+
# => 'संयुक्त राष्ट्र के नेता कहते हैं कि सीरिया में कोई सैन्य समाधान नहीं है'
|
85 |
+
|
86 |
+
# translate from English to Chinese
|
87 |
+
generated_tokens = model.generate(
|
88 |
+
**model_inputs,
|
89 |
+
forced_bos_token_id=tokenizer.lang_code_to_id["zh_CN"]
|
90 |
+
)
|
91 |
+
tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
92 |
+
# => '联合国首脑说,叙利亚没有军事解决办法'
|
93 |
+
```
|
94 |
+
|
95 |
+
See the [model hub](https://huggingface.co/models?filter=mbart-50) to look for more fine-tuned versions.
|
96 |
+
|
97 |
+
## Languages covered
|
98 |
+
Arabic (ar_AR), Czech (cs_CZ), German (de_DE), English (en_XX), Spanish (es_XX), Estonian (et_EE), Finnish (fi_FI), French (fr_XX), Gujarati (gu_IN), Hindi (hi_IN), Italian (it_IT), Japanese (ja_XX), Kazakh (kk_KZ), Korean (ko_KR), Lithuanian (lt_LT), Latvian (lv_LV), Burmese (my_MM), Nepali (ne_NP), Dutch (nl_XX), Romanian (ro_RO), Russian (ru_RU), Sinhala (si_LK), Turkish (tr_TR), Vietnamese (vi_VN), Chinese (zh_CN), Afrikaans (af_ZA), Azerbaijani (az_AZ), Bengali (bn_IN), Persian (fa_IR), Hebrew (he_IL), Croatian (hr_HR), Indonesian (id_ID), Georgian (ka_GE), Khmer (km_KH), Macedonian (mk_MK), Malayalam (ml_IN), Mongolian (mn_MN), Marathi (mr_IN), Polish (pl_PL), Pashto (ps_AF), Portuguese (pt_XX), Swedish (sv_SE), Swahili (sw_KE), Tamil (ta_IN), Telugu (te_IN), Thai (th_TH), Tagalog (tl_XX), Ukrainian (uk_UA), Urdu (ur_PK), Xhosa (xh_ZA), Galician (gl_ES), Slovene (sl_SI)
|
99 |
+
|
100 |
+
|
101 |
+
## BibTeX entry and citation info
|
102 |
+
```
|
103 |
+
@article{tang2020multilingual,
|
104 |
+
title={Multilingual Translation with Extensible Multilingual Pretraining and Finetuning},
|
105 |
+
author={Yuqing Tang and Chau Tran and Xian Li and Peng-Jen Chen and Naman Goyal and Vishrav Chaudhary and Jiatao Gu and Angela Fan},
|
106 |
+
year={2020},
|
107 |
+
eprint={2008.00401},
|
108 |
+
archivePrefix={arXiv},
|
109 |
+
primaryClass={cs.CL}
|
110 |
+
}
|
111 |
+
```
|
config.json
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/home/suraj/projects/mbart-50/hf_models/mbart-50-large-one-to-many/",
|
3 |
+
"_num_labels": 3,
|
4 |
+
"activation_dropout": 0.0,
|
5 |
+
"activation_function": "relu",
|
6 |
+
"add_bias_logits": false,
|
7 |
+
"add_final_layer_norm": true,
|
8 |
+
"architectures": [
|
9 |
+
"MBartForConditionalGeneration"
|
10 |
+
],
|
11 |
+
"attention_dropout": 0.0,
|
12 |
+
"bos_token_id": 0,
|
13 |
+
"classif_dropout": 0.0,
|
14 |
+
"classifier_dropout": 0.0,
|
15 |
+
"d_model": 1024,
|
16 |
+
"decoder_attention_heads": 16,
|
17 |
+
"decoder_ffn_dim": 4096,
|
18 |
+
"decoder_layerdrop": 0.0,
|
19 |
+
"decoder_layers": 12,
|
20 |
+
"decoder_start_token_id": 2,
|
21 |
+
"dropout": 0.1,
|
22 |
+
"early_stopping": true,
|
23 |
+
"encoder_attention_heads": 16,
|
24 |
+
"encoder_ffn_dim": 4096,
|
25 |
+
"encoder_layerdrop": 0.0,
|
26 |
+
"encoder_layers": 12,
|
27 |
+
"eos_token_id": 2,
|
28 |
+
"forced_eos_token_id": 2,
|
29 |
+
"gradient_checkpointing": false,
|
30 |
+
"id2label": {
|
31 |
+
"0": "LABEL_0",
|
32 |
+
"1": "LABEL_1",
|
33 |
+
"2": "LABEL_2"
|
34 |
+
},
|
35 |
+
"init_std": 0.02,
|
36 |
+
"is_encoder_decoder": true,
|
37 |
+
"label2id": {
|
38 |
+
"LABEL_0": 0,
|
39 |
+
"LABEL_1": 1,
|
40 |
+
"LABEL_2": 2
|
41 |
+
},
|
42 |
+
"max_length": 200,
|
43 |
+
"max_position_embeddings": 1024,
|
44 |
+
"model_type": "mbart",
|
45 |
+
"normalize_before": true,
|
46 |
+
"normalize_embedding": true,
|
47 |
+
"num_beams": 5,
|
48 |
+
"num_hidden_layers": 12,
|
49 |
+
"output_past": true,
|
50 |
+
"pad_token_id": 1,
|
51 |
+
"scale_embedding": true,
|
52 |
+
"static_position_embeddings": false,
|
53 |
+
"tokenizer_class": "MBart50Tokenizer",
|
54 |
+
"transformers_version": "4.9.0.dev0",
|
55 |
+
"use_cache": true,
|
56 |
+
"vocab_size": 250054
|
57 |
+
}
|
flax_model.msgpack
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0b7365f3d85fe601e9610ba844e42f92c226cde98146fcd61cf703766f8a97b8
|
3 |
+
size 2444536300
|
generation_config.json
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 0,
|
4 |
+
"decoder_start_token_id": 2,
|
5 |
+
"early_stopping": true,
|
6 |
+
"eos_token_id": 2,
|
7 |
+
"forced_eos_token_id": 2,
|
8 |
+
"max_length": 200,
|
9 |
+
"num_beams": 5,
|
10 |
+
"pad_token_id": 1,
|
11 |
+
"transformers_version": "4.27.0.dev0"
|
12 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:51fbf92efa747400b06d368d5c86b79e4a67799c754bf2c2a81f0bf210efe4c5
|
3 |
+
size 2444714899
|
sentencepiece.bpe.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
|
3 |
+
size 5069051
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}, "additional_special_tokens": ["ar_AR", "cs_CZ", "de_DE", "en_XX", "es_XX", "et_EE", "fi_FI", "fr_XX", "gu_IN", "hi_IN", "it_IT", "ja_XX", "kk_KZ", "ko_KR", "lt_LT", "lv_LV", "my_MM", "ne_NP", "nl_XX", "ro_RO", "ru_RU", "si_LK", "tr_TR", "vi_VN", "zh_CN", "af_ZA", "az_AZ", "bn_IN", "fa_IR", "he_IL", "hr_HR", "id_ID", "ka_GE", "km_KH", "mk_MK", "ml_IN", "mn_MN", "mr_IN", "pl_PL", "ps_AF", "pt_XX", "sv_SE", "sw_KE", "ta_IN", "te_IN", "th_TH", "tl_XX", "uk_UA", "ur_PK", "xh_ZA", "gl_ES", "sl_SI"]}
|
tf_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:006794f8dab36114293441399abd60e934162bac6e70f9c55b878a2d352cbcfb
|
3 |
+
size 2445080688
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"src_lang": null, "tgt_lang": null, "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "cls_token": "<s>", "pad_token": "<pad>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "bos_token": "<s>", "tokenizer_file": null, "language_codes": "ML50", "special_tokens_map_file": "/home/suraj/projects/mbart-50/mbart-50/special_tokens_map.json", "name_or_path": "/home/suraj/projects/mbart-50/hf_models/mbart-50-large-one-to-many/"}
|