Skip to content

Commit

Permalink
Model ema key backward compatibility fix (#6972)
Browse files Browse the repository at this point in the history
Fix for older model loading issue in d3d9cbc#commitcomment-68622388
  • Loading branch information
glenn-jocher committed Mar 14, 2022
1 parent c13d4ce commit 2d45de6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion models/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def attempt_load(weights, map_location=None, inplace=True, fuse=True):
model = Ensemble()
for w in weights if isinstance(weights, list) else [weights]:
ckpt = torch.load(attempt_download(w), map_location=map_location) # load
ckpt = (ckpt['ema'] or ckpt['model']).float() # FP32 model
ckpt = (ckpt.get('ema') or ckpt['model']).float() # FP32 model
model.append(ckpt.fuse().eval() if fuse else ckpt.eval()) # fused or un-fused model in eval mode

# Compatibility updates
Expand Down

0 comments on commit 2d45de6

Please sign in to comment.