prithivida commited on
Commit
48d2ea5
1 Parent(s): d4ad4dd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -2
README.md CHANGED
@@ -14,9 +14,18 @@ pip install git+https://github.com/PrithivirajDamodaran/Parrot.git
14
  # Caveat: the generate part is NOT seeded, so for a same input, multiple runs will produce DIFFERENT outputs for now
15
 
16
  from parrot import Parrot
 
17
  import warnings
18
  warnings.filterwarnings("ignore")
19
 
 
 
 
 
 
 
 
 
20
  #Init models (make sure you init ONLY once if you integrate this to your code)
21
  parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False)
22
 
@@ -33,7 +42,7 @@ for phrase in phrases:
33
  print(para_phrase)
34
  ```
35
 
36
- <pre>
37
  -----------------------------------------------------------------------------
38
  Input_phrase: Can you recommed some upscale restaurants in Rome?
39
  -----------------------------------------------------------------------------
@@ -55,7 +64,43 @@ Input_phrase: What are the famous places we should not miss in Russia
55
  "what are some of the most important places to visit in russia?"
56
  "what are some of the most famous places of russia?"
57
  "what are some places we should not miss in russia?"
58
- </pre>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  ### Knobs
61
 
 
14
  # Caveat: the generate part is NOT seeded, so for a same input, multiple runs will produce DIFFERENT outputs for now
15
 
16
  from parrot import Parrot
17
+ import torch
18
  import warnings
19
  warnings.filterwarnings("ignore")
20
 
21
+
22
+ def set_seed(seed):
23
+ torch.manual_seed(seed)
24
+ if torch.cuda.is_available():
25
+ torch.cuda.manual_seed_all(seed)
26
+
27
+ set_seed(42)
28
+
29
  #Init models (make sure you init ONLY once if you integrate this to your code)
30
  parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False)
31
 
 
42
  print(para_phrase)
43
  ```
44
 
45
+ ```
46
  -----------------------------------------------------------------------------
47
  Input_phrase: Can you recommed some upscale restaurants in Rome?
48
  -----------------------------------------------------------------------------
 
64
  "what are some of the most important places to visit in russia?"
65
  "what are some of the most famous places of russia?"
66
  "what are some places we should not miss in russia?"
67
+ ```
68
+
69
+ ### How to get syntactic and phrasal diversity/variety in your paraphrases using parrot?
70
+
71
+ You can play with the do_diverse knob (check out the next section for more knobs).
72
+ Consider this example: do_diverse = False (default)
73
+
74
+ ```
75
+ ------------------------------------------------------------------------------
76
+ Input_phrase: The ultimate test of your knowledge is your capacity to convey it to another.
77
+ ------------------------------------------------------------------------------
78
+ 'the final test of knowledge is your capacity to impart it '
79
+ 'the ultimate test of a person's knowledge is his ability to transmit it to another '
80
+ 'the ultimate test of knowledge is the ability to communicate it to another '
81
+ 'the ultimate test of knowledge is your ability to communicate it to others '
82
+ 'the test of your knowledge is your capacity to communicate it to others '
83
+ 'the ultimate test for knowledge is the capacity to show it to another '
84
+ 'the ultimate test of your knowledge is your ability to transmit to others '
85
+ 'the ultimate test of a knowledge is your capacity to communicate it to another '
86
+ 'the ultimate test of knowledge is your capacity to transmit it to another '
87
+ 'the final test of your knowledge is your ability to convey it to another '
88
+ ```
89
+ do_diverse = True
90
+ ```
91
+ ------------------------------------------------------------------------------
92
+ Input_phrase: The ultimate test of your knowledge is your capacity to convey it to another.
93
+ ------------------------------------------------------------------------------
94
+ 'one of the ultimate tests of knowledge is your ability to communicate it to another person '
95
+ 'one of the ultimate tests of knowledge is your ability to transmit it to another person '
96
+ 'one of the ultimate tests of knowledge is your ability to communicate it to another '
97
+ 'one of the greatest tests of knowledge is your ability to convey it to another '
98
+ 'one of the ultimate tests of knowledge is your ability to transmit it to another '
99
+ 'one of the ultimate tests of knowledge is your ability to convey it to another person '
100
+ 'one of the ultimate tests of knowledge is the ability to convey it to another '
101
+ 'the ultimate test of your knowledge is your ability to communicate it to another '
102
+ 'the ultimate test of your knowledge is your ability to transmit it to another '
103
+ ```
104
 
105
  ### Knobs
106