Update README.md
#23
by
suliman
- opened
README.md
CHANGED
@@ -53,6 +53,7 @@ language:
|
|
53 |
- xh
|
54 |
- gl
|
55 |
- sl
|
|
|
56 |
tags:
|
57 |
- mbart-50
|
58 |
pipeline_tag: translation
|
@@ -71,7 +72,7 @@ The model can translate directly between any pair of 50 languages. To translate
|
|
71 |
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
72 |
|
73 |
article_hi = "संयुक्त राष्ट्र के प्रमुख का कहना है कि सीरिया में कोई सैन्य समाधान नहीं है"
|
74 |
-
article_ar = "
|
75 |
|
76 |
model = MBartForConditionalGeneration.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
|
77 |
tokenizer = MBart50TokenizerFast.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
|
@@ -87,11 +88,11 @@ tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
|
87 |
# => "Le chef de l 'ONU affirme qu 'il n 'y a pas de solution militaire dans la Syrie."
|
88 |
|
89 |
# translate Arabic to English
|
90 |
-
tokenizer.src_lang = "
|
91 |
encoded_ar = tokenizer(article_ar, return_tensors="pt")
|
92 |
generated_tokens = model.generate(
|
93 |
**encoded_ar,
|
94 |
-
forced_bos_token_id=tokenizer.lang_code_to_id["
|
95 |
)
|
96 |
tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
97 |
# => "The Secretary-General of the United Nations says there is no military solution in Syria."
|
@@ -115,4 +116,4 @@ Arabic (ar_AR), Czech (cs_CZ), German (de_DE), English (en_XX), Spanish (es_XX),
|
|
115 |
archivePrefix={arXiv},
|
116 |
primaryClass={cs.CL}
|
117 |
}
|
118 |
-
```
|
|
|
53 |
- xh
|
54 |
- gl
|
55 |
- sl
|
56 |
+
- pa
|
57 |
tags:
|
58 |
- mbart-50
|
59 |
pipeline_tag: translation
|
|
|
72 |
from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
|
73 |
|
74 |
article_hi = "संयुक्त राष्ट्र के प्रमुख का कहना है कि सीरिया में कोई सैन्य समाधान नहीं है"
|
75 |
+
article_ar = "HI, how are you and i love you huggingface will you love me?"
|
76 |
|
77 |
model = MBartForConditionalGeneration.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
|
78 |
tokenizer = MBart50TokenizerFast.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
|
|
|
88 |
# => "Le chef de l 'ONU affirme qu 'il n 'y a pas de solution militaire dans la Syrie."
|
89 |
|
90 |
# translate Arabic to English
|
91 |
+
tokenizer.src_lang = "en_XX"
|
92 |
encoded_ar = tokenizer(article_ar, return_tensors="pt")
|
93 |
generated_tokens = model.generate(
|
94 |
**encoded_ar,
|
95 |
+
forced_bos_token_id=tokenizer.lang_code_to_id["ps_AF"]
|
96 |
)
|
97 |
tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
|
98 |
# => "The Secretary-General of the United Nations says there is no military solution in Syria."
|
|
|
116 |
archivePrefix={arXiv},
|
117 |
primaryClass={cs.CL}
|
118 |
}
|
119 |
+
```
|