julien-c HF staff commited on
Commit
40e7426
β€’
1 Parent(s): 07c349a

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/Vamsi/T5_Paraphrase_Paws/README.md

Files changed (1) hide show
  1. README.md +51 -0
README.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: "en"
3
+ tags:
4
+ - paraphrase-generation
5
+ - text-generation
6
+ - Conditional Generation
7
+ inference: false
8
+ ---
9
+ ​
10
+ # Paraphrase-Generation
11
+ ​
12
+ ## Model description
13
+ ​
14
+ T5 Model for generating paraphrases of english sentences. Trained on the [Google PAWS](https://github.com/google-research-datasets/paws) dataset.
15
+ ​
16
+ ## How to use
17
+ ​
18
+ PyTorch and TF models available
19
+ ​
20
+ ```python
21
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
22
+ ​
23
+ tokenizer = AutoTokenizer.from_pretrained("Vamsi/T5_Paraphrase_Paws")
24
+ model = AutoModelForSeq2SeqLM.from_pretrained("Vamsi/T5_Paraphrase_Paws")
25
+ ​
26
+ sentence = "This is something which i cannot understand at all"
27
+
28
+ text = "paraphrase: " + sentence + " </s>"
29
+
30
+ encoding = tokenizer.encode_plus(text,pad_to_max_length=True, return_tensors="pt")
31
+ input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
32
+
33
+
34
+ outputs = model.generate(
35
+ input_ids=input_ids, attention_mask=attention_masks,
36
+ max_length=256,
37
+ do_sample=True,
38
+ top_k=120,
39
+ top_p=0.95,
40
+ early_stopping=True,
41
+ num_return_sequences=5
42
+ )
43
+
44
+ for output in outputs:
45
+ line = tokenizer.decode(output, skip_special_tokens=True,clean_up_tokenization_spaces=True)
46
+ print(line)
47
+ ​
48
+
49
+ ```
50
+
51
+ For more reference on training your own T5 model or using this model, do check out [Paraphrase Generation](https://github.com/Vamsi995/Paraphrase-Generator).