Update app.py
Browse filesRemoved parameters of fn paraphrase and outputs model generate.
app.py
CHANGED
@@ -11,14 +11,7 @@ tokenizer = AutoTokenizer.from_pretrained("humarin/chatgpt_paraphraser_on_T5_bas
|
|
11 |
model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
|
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}',
|
@@ -27,12 +20,7 @@ def paraphrase(
|
|
27 |
truncation=True,
|
28 |
).input_ids
|
29 |
|
30 |
-
outputs = model.generate(
|
31 |
-
input_ids, repetition_penalty=repetition_penalty,
|
32 |
-
num_return_sequences=num_return_sequences, no_repeat_ngram_size=no_repeat_ngram_size,
|
33 |
-
num_beams=num_beams, num_beam_groups=num_beam_groups,
|
34 |
-
max_length=max_length, diversity_penalty=diversity_penalty
|
35 |
-
)
|
36 |
|
37 |
res = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
38 |
res1 = res [0]
|
|
|
11 |
model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
|
12 |
|
13 |
def paraphrase(
|
14 |
+
Content_to_Rephrase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
):
|
16 |
input_ids = tokenizer(
|
17 |
f'paraphrase: {Content_to_Rephrase}',
|
|
|
20 |
truncation=True,
|
21 |
).input_ids
|
22 |
|
23 |
+
outputs = model.generate(input_ids)
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
res = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
26 |
res1 = res [0]
|