Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -84,24 +84,28 @@ def paraphrase(sentence: str, count: str):
|
|
84 |
text = f"paraphrase: {sentence_input} </s>"
|
85 |
# encoding = tokenizer.encode_plus(text, padding=True, return_tensors="pt")
|
86 |
encoding = tokenizer(text, return_tensors="pt")
|
87 |
-
input_ids, attention_masks = encoding["input_ids"], encoding["attention_mask"]
|
88 |
|
89 |
-
outputs = model.generate(
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
)
|
98 |
-
res = []
|
99 |
-
for output in outputs:
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
103 |
|
104 |
-
print(
|
|
|
|
|
105 |
|
106 |
return {
|
107 |
'result': {
|
|
|
84 |
text = f"paraphrase: {sentence_input} </s>"
|
85 |
# encoding = tokenizer.encode_plus(text, padding=True, return_tensors="pt")
|
86 |
encoding = tokenizer(text, return_tensors="pt")
|
87 |
+
# input_ids, attention_masks = encoding["input_ids"], encoding["attention_mask"]
|
88 |
|
89 |
+
# outputs = model.generate(
|
90 |
+
# input_ids=input_ids, attention_mask=attention_masks,
|
91 |
+
# max_length=512, # 256,
|
92 |
+
# do_sample=True,
|
93 |
+
# top_k=120,
|
94 |
+
# top_p=0.95,
|
95 |
+
# early_stopping=True,
|
96 |
+
# num_return_sequences=p_count
|
97 |
+
# )
|
98 |
+
# res = []
|
99 |
+
# for output in outputs:
|
100 |
+
# line = tokenizer.decode(
|
101 |
+
# output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
102 |
+
# res.append(line)
|
103 |
+
|
104 |
+
# print(res)
|
105 |
|
106 |
+
print()
|
107 |
+
print(generate_v4(encoding, count))
|
108 |
+
print()
|
109 |
|
110 |
return {
|
111 |
'result': {
|