Update README.md
This commit is contained in:
parent
d4ad4ddaff
commit
48d2ea5ad4
49
README.md
49
README.md
|
@ -14,9 +14,18 @@ pip install git+https://github.com/PrithivirajDamodaran/Parrot.git
|
||||||
# Caveat: the generate part is NOT seeded, so for a same input, multiple runs will produce DIFFERENT outputs for now
|
# Caveat: the generate part is NOT seeded, so for a same input, multiple runs will produce DIFFERENT outputs for now
|
||||||
|
|
||||||
from parrot import Parrot
|
from parrot import Parrot
|
||||||
|
import torch
|
||||||
import warnings
|
import warnings
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
|
|
||||||
|
|
||||||
|
def set_seed(seed):
|
||||||
|
torch.manual_seed(seed)
|
||||||
|
if torch.cuda.is_available():
|
||||||
|
torch.cuda.manual_seed_all(seed)
|
||||||
|
|
||||||
|
set_seed(42)
|
||||||
|
|
||||||
#Init models (make sure you init ONLY once if you integrate this to your code)
|
#Init models (make sure you init ONLY once if you integrate this to your code)
|
||||||
parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False)
|
parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False)
|
||||||
|
|
||||||
|
@ -33,7 +42,7 @@ for phrase in phrases:
|
||||||
print(para_phrase)
|
print(para_phrase)
|
||||||
```
|
```
|
||||||
|
|
||||||
<pre>
|
```
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
Input_phrase: Can you recommed some upscale restaurants in Rome?
|
Input_phrase: Can you recommed some upscale restaurants in Rome?
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -55,7 +64,43 @@ Input_phrase: What are the famous places we should not miss in Russia
|
||||||
"what are some of the most important places to visit in russia?"
|
"what are some of the most important places to visit in russia?"
|
||||||
"what are some of the most famous places of russia?"
|
"what are some of the most famous places of russia?"
|
||||||
"what are some places we should not miss in russia?"
|
"what are some places we should not miss in russia?"
|
||||||
</pre>
|
```
|
||||||
|
|
||||||
|
### How to get syntactic and phrasal diversity/variety in your paraphrases using parrot?
|
||||||
|
|
||||||
|
You can play with the do_diverse knob (check out the next section for more knobs).
|
||||||
|
Consider this example: do_diverse = False (default)
|
||||||
|
|
||||||
|
```
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Input_phrase: The ultimate test of your knowledge is your capacity to convey it to another.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
'the final test of knowledge is your capacity to impart it '
|
||||||
|
'the ultimate test of a person's knowledge is his ability to transmit it to another '
|
||||||
|
'the ultimate test of knowledge is the ability to communicate it to another '
|
||||||
|
'the ultimate test of knowledge is your ability to communicate it to others '
|
||||||
|
'the test of your knowledge is your capacity to communicate it to others '
|
||||||
|
'the ultimate test for knowledge is the capacity to show it to another '
|
||||||
|
'the ultimate test of your knowledge is your ability to transmit to others '
|
||||||
|
'the ultimate test of a knowledge is your capacity to communicate it to another '
|
||||||
|
'the ultimate test of knowledge is your capacity to transmit it to another '
|
||||||
|
'the final test of your knowledge is your ability to convey it to another '
|
||||||
|
```
|
||||||
|
do_diverse = True
|
||||||
|
```
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
Input_phrase: The ultimate test of your knowledge is your capacity to convey it to another.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
'one of the ultimate tests of knowledge is your ability to communicate it to another person '
|
||||||
|
'one of the ultimate tests of knowledge is your ability to transmit it to another person '
|
||||||
|
'one of the ultimate tests of knowledge is your ability to communicate it to another '
|
||||||
|
'one of the greatest tests of knowledge is your ability to convey it to another '
|
||||||
|
'one of the ultimate tests of knowledge is your ability to transmit it to another '
|
||||||
|
'one of the ultimate tests of knowledge is your ability to convey it to another person '
|
||||||
|
'one of the ultimate tests of knowledge is the ability to convey it to another '
|
||||||
|
'the ultimate test of your knowledge is your ability to communicate it to another '
|
||||||
|
'the ultimate test of your knowledge is your ability to transmit it to another '
|
||||||
|
```
|
||||||
|
|
||||||
### Knobs
|
### Knobs
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue