SeyedAli commited on
Commit
c801e03
1 Parent(s): a48d623

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -1
README.md CHANGED
@@ -9,4 +9,38 @@ tags:
9
  - persian
10
  - farsi
11
  license: mit
12
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  - persian
10
  - farsi
11
  license: mit
12
+ ---
13
+ # Machine Translation
14
+ This is an mT5-based model for machine translation (English -> Persian).
15
+ Here is an example of how you can run this model:
16
+
17
+ ```python
18
+ from transformers import MT5ForConditionalGeneration, MT5Tokenizer
19
+
20
+ model_name = "SeyedAli/English-to-Persian-Translation-mT5-V1"
21
+ tokenizer = MT5Tokenizer.from_pretrained(model_name)
22
+ model = MT5ForConditionalGeneration.from_pretrained(model_name)
23
+
24
+
25
+ def run_model(input_string, **generator_args):
26
+ input_ids = tokenizer.encode(input_string, return_tensors="pt")
27
+ res = model.generate(input_ids, **generator_args)
28
+ output = tokenizer.batch_decode(res, skip_special_tokens=True)
29
+ print(output)
30
+ return output
31
+
32
+
33
+ run_model("Praise be to Allah, the Cherisher and Sustainer of the worlds;")
34
+ run_model("shrouds herself in white and walks penitentially disguised as brotherly love through factories and parliaments; offers help, but desires power;")
35
+ run_model("He thanked all fellow bloggers and organizations that showed support.")
36
+ run_model("Races are held between April and December at the Veliefendi Hippodrome near Bakerky, 15 km (9 miles) west of Istanbul.")
37
+ run_model("I want to pursue PhD in Computer Science about social network,what is the open problem in social networks?")
38
+ ```
39
+ which should output:
40
+ ```
41
+ ['برای الله، یعنی چرنده و سوزان دنیا، تحسین کنید']
42
+ ['خودش را در سفید پوسته می کند و به صورت عشق برادرانه']
43
+ ['او از تمام بلاگرها و سازمان هایی که حمایتشان را نشان می داد']
44
+ ['در طول ماه آوریل و دسامبر در والی فیودورونا نزدیک بیکر']
45
+ ['من می خواهم در مورد شبکه اجتماعی تحقیقات علوم کامپیوتری را دن']
46
+ ```