ultralytics 8.1.41 DDP resume untrained-checkpoint fix (#9453)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Laughing-q <1185102784@qq.com>
This commit is contained in:
Glenn Jocher 2024-04-01 19:46:04 +02:00 committed by GitHub
parent 2cee8893d9
commit 959acf67db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 15 deletions

View file

@ -513,7 +513,7 @@ def convert_optimizer_state_dict_to_fp16(state_dict):
"""
for state in state_dict["state"].values():
for k, v in state.items():
if isinstance(v, torch.Tensor) and v.dtype is torch.float32:
if k != "step" and isinstance(v, torch.Tensor) and v.dtype is torch.float32:
state[k] = v.half()
return state_dict