entai2965 commited on
Commit
f6097ef
1 Parent(s): 6bc49f2

updated readme

Browse files
Files changed (1) hide show
  1. README.md +164 -0
README.md CHANGED
@@ -1,3 +1,167 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: mit
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - multilingual
4
+ - af
5
+ - am
6
+ - ar
7
+ - ast
8
+ - az
9
+ - ba
10
+ - be
11
+ - bg
12
+ - bn
13
+ - br
14
+ - bs
15
+ - ca
16
+ - ceb
17
+ - cs
18
+ - cy
19
+ - da
20
+ - de
21
+ - el
22
+ - en
23
+ - es
24
+ - et
25
+ - fa
26
+ - ff
27
+ - fi
28
+ - fr
29
+ - fy
30
+ - ga
31
+ - gd
32
+ - gl
33
+ - gu
34
+ - ha
35
+ - he
36
+ - hi
37
+ - hr
38
+ - ht
39
+ - hu
40
+ - hy
41
+ - id
42
+ - ig
43
+ - ilo
44
+ - is
45
+ - it
46
+ - ja
47
+ - jv
48
+ - ka
49
+ - kk
50
+ - km
51
+ - kn
52
+ - ko
53
+ - lb
54
+ - lg
55
+ - ln
56
+ - lo
57
+ - lt
58
+ - lv
59
+ - mg
60
+ - mk
61
+ - ml
62
+ - mn
63
+ - mr
64
+ - ms
65
+ - my
66
+ - ne
67
+ - nl
68
+ - 'no'
69
+ - ns
70
+ - oc
71
+ - or
72
+ - pa
73
+ - pl
74
+ - ps
75
+ - pt
76
+ - ro
77
+ - ru
78
+ - sd
79
+ - si
80
+ - sk
81
+ - sl
82
+ - so
83
+ - sq
84
+ - sr
85
+ - ss
86
+ - su
87
+ - sv
88
+ - sw
89
+ - ta
90
+ - th
91
+ - tl
92
+ - tn
93
+ - tr
94
+ - uk
95
+ - ur
96
+ - uz
97
+ - vi
98
+ - wo
99
+ - xh
100
+ - yi
101
+ - yo
102
+ - zh
103
+ - zu
104
  license: mit
105
+ tags:
106
+ - nmt
107
  ---
108
+
109
+ From: https://huggingface.co/facebook/m2m100_418M
110
+
111
+ # M2M100 418M
112
+
113
+ M2M100 is a multilingual encoder-decoder (seq-to-seq) model trained for Many-to-Many multilingual translation.
114
+ It was introduced in this [paper](https://arxiv.org/abs/2010.11125) and first released in [this](https://github.com/pytorch/fairseq/tree/master/examples/m2m_100) repository.
115
+
116
+ The model that can directly translate between the 9,900 directions of 100 languages.
117
+ To translate into a target language, the target language id is forced as the first generated token.
118
+ To force the target language id as the first generated token, pass the `forced_bos_token_id` parameter to the `generate` method.
119
+
120
+ *Note: `M2M100Tokenizer` depends on `sentencepiece`, so make sure to install it before running the example.*
121
+
122
+ To install `sentencepiece` run `pip install sentencepiece`
123
+
124
+
125
+ ```python
126
+ from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
127
+
128
+ hi_text = "जीवन एक चॉकलेट बॉक्स की तरह है।"
129
+ chinese_text = "生活就像一盒巧克力。"
130
+
131
+ model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
132
+ tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M")
133
+
134
+ # translate Hindi to French
135
+ tokenizer.src_lang = "hi"
136
+ encoded_hi = tokenizer(hi_text, return_tensors="pt")
137
+ generated_tokens = model.generate(**encoded_hi, forced_bos_token_id=tokenizer.get_lang_id("fr"))
138
+ tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
139
+ # => "La vie est comme une boîte de chocolat."
140
+
141
+ # translate Chinese to English
142
+ tokenizer.src_lang = "zh"
143
+ encoded_zh = tokenizer(chinese_text, return_tensors="pt")
144
+ generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id("en"))
145
+ tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
146
+ # => "Life is like a box of chocolate."
147
+ ```
148
+
149
+
150
+ See the [model hub](https://huggingface.co/models?filter=m2m_100) to look for more fine-tuned versions.
151
+
152
+
153
+ ## Languages covered
154
+ Afrikaans (af), Amharic (am), Arabic (ar), Asturian (ast), Azerbaijani (az), Bashkir (ba), Belarusian (be), Bulgarian (bg), Bengali (bn), Breton (br), Bosnian (bs), Catalan; Valencian (ca), Cebuano (ceb), Czech (cs), Welsh (cy), Danish (da), German (de), Greeek (el), English (en), Spanish (es), Estonian (et), Persian (fa), Fulah (ff), Finnish (fi), French (fr), Western Frisian (fy), Irish (ga), Gaelic; Scottish Gaelic (gd), Galician (gl), Gujarati (gu), Hausa (ha), Hebrew (he), Hindi (hi), Croatian (hr), Haitian; Haitian Creole (ht), Hungarian (hu), Armenian (hy), Indonesian (id), Igbo (ig), Iloko (ilo), Icelandic (is), Italian (it), Japanese (ja), Javanese (jv), Georgian (ka), Kazakh (kk), Central Khmer (km), Kannada (kn), Korean (ko), Luxembourgish; Letzeburgesch (lb), Ganda (lg), Lingala (ln), Lao (lo), Lithuanian (lt), Latvian (lv), Malagasy (mg), Macedonian (mk), Malayalam (ml), Mongolian (mn), Marathi (mr), Malay (ms), Burmese (my), Nepali (ne), Dutch; Flemish (nl), Norwegian (no), Northern Sotho (ns), Occitan (post 1500) (oc), Oriya (or), Panjabi; Punjabi (pa), Polish (pl), Pushto; Pashto (ps), Portuguese (pt), Romanian; Moldavian; Moldovan (ro), Russian (ru), Sindhi (sd), Sinhala; Sinhalese (si), Slovak (sk), Slovenian (sl), Somali (so), Albanian (sq), Serbian (sr), Swati (ss), Sundanese (su), Swedish (sv), Swahili (sw), Tamil (ta), Thai (th), Tagalog (tl), Tswana (tn), Turkish (tr), Ukrainian (uk), Urdu (ur), Uzbek (uz), Vietnamese (vi), Wolof (wo), Xhosa (xh), Yiddish (yi), Yoruba (yo), Chinese (zh), Zulu (zu)
155
+
156
+
157
+ ## BibTeX entry and citation info
158
+ ```
159
+ @misc{fan2020englishcentric,
160
+ title={Beyond English-Centric Multilingual Machine Translation},
161
+ author={Angela Fan and Shruti Bhosale and Holger Schwenk and Zhiyi Ma and Ahmed El-Kishky and Siddharth Goyal and Mandeep Baines and Onur Celebi and Guillaume Wenzek and Vishrav Chaudhary and Naman Goyal and Tom Birch and Vitaliy Liptchinsky and Sergey Edunov and Edouard Grave and Michael Auli and Armand Joulin},
162
+ year={2020},
163
+ eprint={2010.11125},
164
+ archivePrefix={arXiv},
165
+ primaryClass={cs.CL}
166
+ }
167
+ ```