未验证 提交 6b94eb30 编写于 作者: W wangxinxin08 提交者: GitHub

fix problem while applying ema without training (#2840)

上级 49ff309e
...@@ -249,6 +249,8 @@ class ModelEMA(object): ...@@ -249,6 +249,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.
先完成此消息的编辑!
想要评论请 注册