naot97 commited on
Commit
b48f19a
1 Parent(s): ac2d9b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -94,16 +94,9 @@ def evaluate(
94
  num_beams=num_beams,
95
  **kwargs,
96
  )
97
- with torch.no_grad():
98
- generation_output = model.generate(
99
- input_ids=input_ids,
100
- generation_config=generation_config,
101
- return_dict_in_generate=True,
102
- output_scores=True,
103
- max_new_tokens=max_new_tokens,
104
- )
105
- s = generation_output.sequences[0]
106
- output = tokenizer.decode(s)
107
  return output[len(input_ids):]
108
 
109
 
 
94
  num_beams=num_beams,
95
  **kwargs,
96
  )
97
+ with torch.cuda.amp.autocast():
98
+ output_tokens = model.generate(**inputs, generation_config=generation_config)
99
+ output = tokenizer.decode(output_tokens[0], skip_special_tokens=True)
 
 
 
 
 
 
 
100
  return output[len(input_ids):]
101
 
102