suliman commited on
Commit
1fcdeeb
1 Parent(s): e30b6cb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -71,7 +71,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 +87,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 = "ar_AR"
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["en_XX"]
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."
 
71
  from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
72
 
73
  article_hi = "संयुक्त राष्ट्र के प्रमुख का कहना है कि सीरिया में कोई सैन्य समाधान नहीं है"
74
+ article_ar = "HI, my name is khan i love you?"
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
  # => "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 = "en_XX"
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["ps_AF"]
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."