Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Paraphrase Generation with IndoT5 Base
|
2 |
+
|
3 |
+
IndoT5-base trained on translated PAWS.
|
4 |
+
|
5 |
+
## Model in action
|
6 |
+
|
7 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
8 |
+
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained("Wikidepia/IndoT5-base-paraphrase")
|
10 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("Wikidepia/IndoT5-base-paraphrase")
|
11 |
+
|
12 |
+
sentence = "Anak anak melakukan piket kelas agar kebersihan kelas terjaga"
|
13 |
+
text = "paraphrase: " + sentence + " </s>"
|
14 |
+
|
15 |
+
encoding = tokenizer(text, padding='longest', return_tensors="pt")
|
16 |
+
outputs = model.generate(
|
17 |
+
input_ids=encoding["input_ids"], attention_mask=encoding["attention_mask"],
|
18 |
+
max_length=512,
|
19 |
+
do_sample=True,
|
20 |
+
top_k=200,
|
21 |
+
top_p=0.95,
|
22 |
+
early_stopping=True,
|
23 |
+
num_return_sequences=5
|
24 |
+
)
|