zero-mAP fix return `.detach()` to EMA (#9056)
Resolves https://github.com/ultralytics/hub/issues/82 Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>pull/9058/head
parent
93f63ee33f
commit
841f312f93
|
@ -422,7 +422,7 @@ class ModelEMA:
|
|||
for k, v in self.ema.state_dict().items():
|
||||
if v.dtype.is_floating_point: # true for FP16 and FP32
|
||||
v *= d
|
||||
v += (1 - d) * msd[k]
|
||||
v += (1 - d) * msd[k].detach()
|
||||
assert v.dtype == msd[k].dtype == torch.float32, f'EMA {v.dtype} and model {msd[k]} must be updated in FP32'
|
||||
|
||||
def update_attr(self, model, include=(), exclude=('process_group', 'reducer')):
|
||||
|
|
Loading…
Reference in New Issue