Update README.md
Browse files
README.md
CHANGED
@@ -4,11 +4,37 @@ language:
|
|
4 |
- fa
|
5 |
---
|
6 |
|
7 |
-
This model is intended for non-commercial use only. If you wish to use it for commercial purposes, please make sure to refer to this LinkedIn address.
|
8 |
|
9 |
-
Viravirast is an editor based on transformer algorithms. By visiting the Viravirast.com, you can use a Persian semantic and structural text editor.
|
10 |
|
11 |
|
12 |
usage
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
|
|
4 |
- fa
|
5 |
---
|
6 |
|
7 |
+
***This model is intended for non-commercial use only. If you wish to use it for commercial purposes, please make sure to refer to this LinkedIn address.
|
8 |
|
9 |
+
"Viravirast" is an editor based on transformer algorithms. By visiting the Viravirast.com, you can use a Persian semantic and structural text editor.
|
10 |
|
11 |
|
12 |
usage
|
13 |
|
14 |
+
from transformers import (
|
15 |
+
T5Tokenizer,
|
16 |
+
MT5ForConditionalGeneration,
|
17 |
+
Text2TextGenerationPipeline,
|
18 |
+
)
|
19 |
+
|
20 |
+
path = r".\fine-tuned_mt5"
|
21 |
+
pipe = Text2TextGenerationPipeline(
|
22 |
+
model=MT5ForConditionalGeneration.from_pretrained(path),
|
23 |
+
tokenizer=T5Tokenizer.from_pretrained(path),
|
24 |
+
)
|
25 |
+
|
26 |
+
sentence = "ویراویراست یک نرم افزار ویرایش متن ساختاری و معنایی زبان فارسی است چیزی شبیه به گرامرلی در زبان انگلیسی"
|
27 |
+
#res = pipe(sentence, max_length=100, num_beams=4)
|
28 |
+
res = pipe(sentence, max_length=100)
|
29 |
+
print(res[0]['generated_text'])
|
30 |
+
|
31 |
+
|
32 |
+
-----------------------
|
33 |
+
n_epochs = 4
|
34 |
+
train_batch_size = 8
|
35 |
+
eval_batch_size = 4
|
36 |
+
lr = 5e-4
|
37 |
+
|
38 |
+
Training_loss=0.00550
|
39 |
+
Validation_loss=0.052046
|
40 |
|