未验证 提交 0adc553a 编写于 作者: W wangxinxin08 提交者: GitHub

fix problem while applying ema without training (#2839)

上级 a2f3fd43
...@@ -248,6 +248,8 @@ class ModelEMA(object): ...@@ -248,6 +248,8 @@ class ModelEMA(object):
self.step += 1 self.step += 1
def apply(self): def apply(self):
if self.step == 0:
return self.state_dict
state_dict = dict() state_dict = dict()
for k, v in self.state_dict.items(): for k, v in self.state_dict.items():
v = v / (1 - self._decay**self.step) v = v / (1 - self._decay**self.step)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册