Unverified 提交 cff9717d authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Comment EMA assert (#9173)

上级 5d3d051c
...@@ -422,7 +422,7 @@ class ModelEMA: ...@@ -422,7 +422,7 @@ class ModelEMA:
if v.dtype.is_floating_point: # true for FP16 and FP32 if v.dtype.is_floating_point: # true for FP16 and FP32
v *= d v *= d
v += (1 - d) * msd[k].detach() v += (1 - d) * msd[k].detach()
assert v.dtype == msd[k].detach().dtype == torch.float32, f'EMA {v.dtype} and model {msd[k]} must both be FP32' # assert v.dtype == msd[k].dtype == torch.float32, f'{k}: EMA {v.dtype} and model {msd[k].dtype} must be FP32'
def update_attr(self, model, include=(), exclude=('process_group', 'reducer')): def update_attr(self, model, include=(), exclude=('process_group', 'reducer')):
# Update EMA attributes # Update EMA attributes
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论