Update app.py
Browse files
app.py
CHANGED
@@ -25,10 +25,8 @@ def greet(text):
|
|
25 |
batch = tokenizer(f"\"{text}\" ->: ", return_tensors='pt')
|
26 |
|
27 |
# Use torch.no_grad to disable gradient calculation
|
28 |
-
with torch
|
29 |
-
.
|
30 |
-
output_tokens = model.generate(**batch, do_sample=True, max_new_tokens=15
|
31 |
-
)
|
32 |
|
33 |
return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
34 |
|
|
|
25 |
batch = tokenizer(f"\"{text}\" ->: ", return_tensors='pt')
|
26 |
|
27 |
# Use torch.no_grad to disable gradient calculation
|
28 |
+
with torch.no_grad():
|
29 |
+
output_tokens = model.generate(**batch, do_sample=True, max_new_tokens=15)
|
|
|
|
|
30 |
|
31 |
return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
32 |
|