Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -48,15 +48,15 @@ def generate_paraphrase(text: str, style: str = "standard", num_variations: int
|
|
48 |
}.get(style, {"temperature": 1.0, "top_k": 50})
|
49 |
|
50 |
# Tokenize the input text
|
51 |
-
inputs = tokenizer(text, truncation=
|
52 |
|
53 |
# Generate paraphrases
|
54 |
with torch.no_grad():
|
55 |
outputs = model.generate(
|
56 |
**inputs,
|
57 |
-
max_length=
|
58 |
num_return_sequences=num_variations,
|
59 |
-
num_beams=
|
60 |
temperature=params["temperature"],
|
61 |
top_k=params["top_k"],
|
62 |
do_sample=True,
|
|
|
48 |
}.get(style, {"temperature": 1.0, "top_k": 50})
|
49 |
|
50 |
# Tokenize the input text
|
51 |
+
inputs = tokenizer(text, truncation=False, padding='longest', return_tensors="pt").to(device)
|
52 |
|
53 |
# Generate paraphrases
|
54 |
with torch.no_grad():
|
55 |
outputs = model.generate(
|
56 |
**inputs,
|
57 |
+
max_length=10000,
|
58 |
num_return_sequences=num_variations,
|
59 |
+
num_beams=10,
|
60 |
temperature=params["temperature"],
|
61 |
top_k=params["top_k"],
|
62 |
do_sample=True,
|