fix: when eval only, AMP can be enabled

pull/1874/head
gaotingquan 2022-04-21 06:59:16 +00:00 committed by Tingquan Gao
parent 0218742ba5
commit b86ddf470e
1 changed files with 2 additions and 2 deletions

View File

@ -98,8 +98,8 @@ class Engine(object):
logger.info('train with paddle {} and device {}'.format(
paddle.__version__, self.device))
# AMP training
self.amp = True if "AMP" in self.config and self.mode == "train" else False
# AMP training and evaluating
self.amp = "AMP" in self.config
if self.amp and self.config["AMP"] is not None:
self.scale_loss = self.config["AMP"].get("scale_loss", 1.0)
self.use_dynamic_loss_scaling = self.config["AMP"].get(