diff --git a/ppdet/optimizer.py b/ppdet/optimizer.py index dfb49e9cc447ed6cfdc20b7d50a85ded1d84cac8..1fcfbf856a9f0bb110607e2dfe0fd768d511a966 100644 --- a/ppdet/optimizer.py +++ b/ppdet/optimizer.py @@ -248,6 +248,8 @@ class ModelEMA(object): self.step += 1 def apply(self): + if self.step == 0: + return self.state_dict state_dict = dict() for k, v in self.state_dict.items(): v = v / (1 - self._decay**self.step)