Skip to content

Commit 0adc553

Browse files
authored
fix problem while applying ema without training (PaddlePaddle#2839)
1 parent a2f3fd4 commit 0adc553

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ppdet/optimizer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ def update(self, model):
248248
self.step += 1
249249

250250
def apply(self):
251+
if self.step == 0:
252+
return self.state_dict
251253
state_dict = dict()
252254
for k, v in self.state_dict.items():
253255
v = v / (1 - self._decay**self.step)

0 commit comments

Comments
 (0)