diff --git a/ppdet/optimizer.py b/ppdet/optimizer.py index c476e2edb7b01a64795e099b4e3de1dad6141841..5334eba724d9b7ecfd5ec080ba58a02c20bb6434 100644 --- a/ppdet/optimizer.py +++ b/ppdet/optimizer.py @@ -249,6 +249,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)