Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -58,12 +58,15 @@ def generate_v3(inputs, count):
|
|
58 |
return sentences
|
59 |
|
60 |
|
61 |
-
def generate_v4(
|
62 |
"""Generate text using a Diverse Beam Search strategy."""
|
63 |
-
|
|
|
|
|
|
|
64 |
outputs = model.generate(input_ids=input_ids,
|
65 |
attention_mask=attention_masks,
|
66 |
-
max_length=512,
|
67 |
do_sample=True,
|
68 |
top_k=120,
|
69 |
top_p=0.95,
|
@@ -109,10 +112,10 @@ def paraphrase(sentence: str, count: str):
|
|
109 |
|
110 |
return {
|
111 |
'result': {
|
112 |
-
'generate_v1':generate_v1(encoding, count),
|
113 |
-
'generate_v2':generate_v2(encoding, count),
|
114 |
-
'generate_v3':generate_v3(encoding, count),
|
115 |
-
'generate_v4':generate_v4(encoding, count),
|
116 |
}
|
117 |
}
|
118 |
|
|
|
58 |
return sentences
|
59 |
|
60 |
|
61 |
+
def generate_v4(encoding, count):
|
62 |
"""Generate text using a Diverse Beam Search strategy."""
|
63 |
+
print(encoding)
|
64 |
+
input_ids, attention_masks = encoding["input_ids"], encoding["attention_mask"]
|
65 |
+
print(input_ids)
|
66 |
+
print(attention_masks)
|
67 |
outputs = model.generate(input_ids=input_ids,
|
68 |
attention_mask=attention_masks,
|
69 |
+
max_length=512,
|
70 |
do_sample=True,
|
71 |
top_k=120,
|
72 |
top_p=0.95,
|
|
|
112 |
|
113 |
return {
|
114 |
'result': {
|
115 |
+
# 'generate_v1':generate_v1(encoding, count),
|
116 |
+
# 'generate_v2':generate_v2(encoding, count),
|
117 |
+
# 'generate_v3':generate_v3(encoding, count),
|
118 |
+
# 'generate_v4':generate_v4(encoding, count),
|
119 |
}
|
120 |
}
|
121 |
|