PhantHive commited on
Commit
3050985
1 Parent(s): d08a677

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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.no_grad():
21
- output_tokens = model.generate(**batch, do_sample=True, max_new_tokens=20)
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