Update app.py
Browse filesChanged beams and beam groups from 5 to 10, max length - 300, repetition penalty from 10 to 1.
app.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
#---------------------AI Paraphraser - iFrame code --------------
|
2 |
-
|
3 |
-
#----------------------------------------------------------------
|
4 |
-
#----------------------------------------------------------------
|
5 |
|
6 |
import transformers
|
7 |
import gradio as gr
|
@@ -14,13 +12,13 @@ model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5
|
|
14 |
|
15 |
def paraphrase(
|
16 |
Content_to_Rephrase,
|
17 |
-
num_beams=
|
18 |
-
num_beam_groups=
|
19 |
-
num_return_sequences=
|
20 |
-
repetition_penalty=
|
21 |
diversity_penalty=3.0,
|
22 |
no_repeat_ngram_size=2,
|
23 |
-
max_length=
|
24 |
):
|
25 |
input_ids = tokenizer(
|
26 |
f'paraphrase: {Content_to_Rephrase}',
|
@@ -39,8 +37,8 @@ def paraphrase(
|
|
39 |
res = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
40 |
res1 = res [0]
|
41 |
res2 = res [1]
|
42 |
-
res3 = res [
|
43 |
-
|
44 |
|
45 |
return res1, res2, res3
|
46 |
|
|
|
1 |
#---------------------AI Paraphraser - iFrame code --------------
|
2 |
+
|
|
|
|
|
3 |
|
4 |
import transformers
|
5 |
import gradio as gr
|
|
|
12 |
|
13 |
def paraphrase(
|
14 |
Content_to_Rephrase,
|
15 |
+
num_beams=10,
|
16 |
+
num_beam_groups=10,
|
17 |
+
num_return_sequences=3,
|
18 |
+
repetition_penalty=1.0,
|
19 |
diversity_penalty=3.0,
|
20 |
no_repeat_ngram_size=2,
|
21 |
+
max_length=300
|
22 |
):
|
23 |
input_ids = tokenizer(
|
24 |
f'paraphrase: {Content_to_Rephrase}',
|
|
|
37 |
res = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
38 |
res1 = res [0]
|
39 |
res2 = res [1]
|
40 |
+
res3 = res [2]
|
41 |
+
|
42 |
|
43 |
return res1, res2, res3
|
44 |
|