File size: 1,059 Bytes
2fda366
1b55c8a
054affb
1b55c8a
c1d685f
1b55c8a
c1d685f
1b55c8a
c1d685f
 
1b55c8a
c1d685f
8cade7d
 
 
 
 
 
 
 
2d90b23
8cade7d
 
 
 
 
 
 
 
 
 
 
 
 
c1d685f
b1d6579
1b55c8a
0310dda
1b55c8a
b1d6579
1b55c8a
0310dda
1b55c8a
c1d685f
8cade7d
 
 
0310dda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
language:
- fa
license: mit
---
***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.

"Viravirast" is an editor based on transformer algorithms. By visiting the Viravirast.com, you can use a Persian semantic and structural text editor.


usage

from transformers import (
  T5Tokenizer,
  MT5ForConditionalGeneration,
  Text2TextGenerationPipeline,
)


path = ""

pipe = Text2TextGenerationPipeline(
  model=MT5ForConditionalGeneration.from_pretrained(path),
  tokenizer=T5Tokenizer.from_pretrained(path),
)


sentence = "ویراویراست یک نرم افزار ویرایش متن ساختاری و معنایی زبان فارسی است چیزی شبیه به گرامرلی در زبان انگلیسی"

#res = pipe(sentence, max_length=100, num_beams=4

res = pipe(sentence, max_length=100)

print(res[0]['generated_text'])


n_epochs = 4

train_batch_size = 8

eval_batch_size = 4

lr = 5e-4 

Training_Loss=0.00550

Validation_Loss=0.052046