Update README.md
Browse files
README.md
CHANGED
|
@@ -10,6 +10,27 @@ license: mit
|
|
| 10 |
|
| 11 |
usage
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
n_epochs = 4
|
|
@@ -20,4 +41,7 @@ eval_batch_size = 4
|
|
| 20 |
|
| 21 |
lr = 5e-4
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
|
|
|
|
| 10 |
|
| 11 |
usage
|
| 12 |
|
| 13 |
+
from transformers import (
|
| 14 |
+
T5Tokenizer,
|
| 15 |
+
MT5ForConditionalGeneration,
|
| 16 |
+
Text2TextGenerationPipeline,
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
path = ""
|
| 21 |
+
pipe = Text2TextGenerationPipeline(
|
| 22 |
+
model=MT5ForConditionalGeneration.from_pretrained(path),
|
| 23 |
+
tokenizer=T5Tokenizer.from_pretrained(path),
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
sentence = "ویراویراست یک نرم افزار ویرایش متن ساختاری و معنایی زبان فارسی است چیزی شبیه به گرامرلی در زبان انگلیسی"
|
| 28 |
+
|
| 29 |
+
#res = pipe(sentence, max_length=100, num_beams=4
|
| 30 |
+
|
| 31 |
+
res = pipe(sentence, max_length=100)
|
| 32 |
+
|
| 33 |
+
print(res[0]['generated_text'])
|
| 34 |
|
| 35 |
|
| 36 |
n_epochs = 4
|
|
|
|
| 41 |
|
| 42 |
lr = 5e-4
|
| 43 |
|
| 44 |
+
Training_Loss=0.00550
|
| 45 |
+
|
| 46 |
+
Validation_Loss=0.052046
|
| 47 |
|