From b86ddf470eeb7579115feaff4ad6a0fcfa50b688 Mon Sep 17 00:00:00 2001 From: gaotingquan Date: Thu, 21 Apr 2022 06:59:16 +0000 Subject: [PATCH] fix: when eval only, AMP can be enabled --- ppcls/engine/engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppcls/engine/engine.py b/ppcls/engine/engine.py index 7a7bbde6..b36aeb70 100644 --- a/ppcls/engine/engine.py +++ b/ppcls/engine/engine.py @@ -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( -- GitLab