Skip to content

Commit 841f312

Browse files
authored
zero-mAP fix return .detach() to EMA (#9056)
Resolves ultralytics/hub#82 Signed-off-by: Glenn Jocher <[email protected]> Signed-off-by: Glenn Jocher <[email protected]>
1 parent 93f63ee commit 841f312

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/torch_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ def update(self, model):
422422
for k, v in self.ema.state_dict().items():
423423
if v.dtype.is_floating_point: # true for FP16 and FP32
424424
v *= d
425-
v += (1 - d) * msd[k]
425+
v += (1 - d) * msd[k].detach()
426426
assert v.dtype == msd[k].dtype == torch.float32, f'EMA {v.dtype} and model {msd[k]} must be updated in FP32'
427427

428428
def update_attr(self, model, include=(), exclude=('process_group', 'reducer')):

0 commit comments

Comments
 (0)