Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -94,16 +94,9 @@ def evaluate(
|
|
94 |
num_beams=num_beams,
|
95 |
**kwargs,
|
96 |
)
|
97 |
-
with torch.
|
98 |
-
|
99 |
-
|
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 |
|