Update README.md
Browse files
README.md
CHANGED
@@ -2,6 +2,27 @@ A monolingual T5 model for Persian trained on OSCAR 21.09 (https://oscar-corpus.
|
|
2 |
|
3 |
It's similar to the English T5 model but just for Persian. You may need to fine-tune it on your specific task.
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
Steps: 725000
|
6 |
|
7 |
Accuracy: 0.66
|
|
|
2 |
|
3 |
It's similar to the English T5 model but just for Persian. You may need to fine-tune it on your specific task.
|
4 |
|
5 |
+
Example code:
|
6 |
+
|
7 |
+
```
|
8 |
+
from transformers import T5ForConditionalGeneration,AutoTokenizer
|
9 |
+
|
10 |
+
import torch
|
11 |
+
|
12 |
+
model_name = "Ahmad/parsT5-base"
|
13 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
14 |
+
model = T5ForConditionalGeneration.from_pretrained(model_name)
|
15 |
+
|
16 |
+
input_ids = tokenizer.encode('دانش آموزان به <extra_id_0> میروند و <extra_id_1> میخوانند.', return_tensors='pt')
|
17 |
+
with torch.no_grad():
|
18 |
+
hypotheses = model.generate(input_ids)
|
19 |
+
for h in hypotheses:
|
20 |
+
print(tokenizer.decode(h))
|
21 |
+
```
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
Steps: 725000
|
27 |
|
28 |
Accuracy: 0.66
|