Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,8 @@ def greet(text):
|
|
17 |
batch = tokenizer(f"'{text}' ->: ", return_tensors='pt')
|
18 |
|
19 |
# Use torch.no_grad to disable gradient calculation
|
20 |
-
with torch.
|
21 |
-
output_tokens = model.generate(**batch,
|
22 |
|
23 |
return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
24 |
|
|
|
17 |
batch = tokenizer(f"'{text}' ->: ", return_tensors='pt')
|
18 |
|
19 |
# Use torch.no_grad to disable gradient calculation
|
20 |
+
with torch.cuda.amp.autocast():
|
21 |
+
output_tokens = model.generate(**batch, max_new_tokens=20)
|
22 |
|
23 |
return tokenizer.decode(output_tokens[0], skip_special_tokens=True)
|
24 |
|