File size: 960 Bytes
570a7cb
 
 
 
6cb11ec
 
 
 
 
 
acd8a22
6cb11ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
acd8a22
6a303f2
 
 
 
 
 
 
 
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
---
language:
- id
---
# Paraphrase Generation with IndoT5 Base

IndoT5-base trained on translated PAWS.

## Model in action

```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("Wikidepia/IndoT5-base-paraphrase")  
model = AutoModelForSeq2SeqLM.from_pretrained("Wikidepia/IndoT5-base-paraphrase")

sentence = "Anak anak melakukan piket kelas agar kebersihan kelas terjaga"
text =  "paraphrase: " + sentence + " </s>"

encoding = tokenizer(text, padding='longest', return_tensors="pt")
outputs = model.generate(
    input_ids=encoding["input_ids"], attention_mask=encoding["attention_mask"],
    max_length=512,
    do_sample=True,
    top_k=200,
    top_p=0.95,
    early_stopping=True,
    num_return_sequences=5
)
```

## Limitations

Sometimes paraphrase contain date which doesnt exists in the original text :/

## Acknowledgement

Thanks to Tensorflow Research Cloud for providing TPU v3-8s.