Unverified Commit c153bcc5 authored by luyug's avatar luyug Committed by GitHub
Browse files

Add mixed precision evaluation (#8036)

* Add mixed precision evaluation

* use original flag
parent 9aa28266
...@@ -1466,7 +1466,11 @@ class Trainer: ...@@ -1466,7 +1466,11 @@ class Trainer:
inputs = self._prepare_inputs(inputs) inputs = self._prepare_inputs(inputs)
with torch.no_grad(): with torch.no_grad():
outputs = model(**inputs) if self.args.fp16 and _use_native_amp:
with autocast():
outputs = model(**inputs)
else:
outputs = model(**inputs)
if has_labels: if has_labels:
loss = outputs[0].mean().detach() loss = outputs[0].mean().detach()
logits = outputs[1:] logits = outputs[1:]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment