Skip to content

Commit

Permalink
Minor fix in checkpoint loading
Browse files Browse the repository at this point in the history
  • Loading branch information
rpautrat committed Mar 28, 2023
1 parent 0df135f commit 3d7bcd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sold2/misc/train_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ def remove_old_checkpoints(checkpoint_root, max_ckpt=15):


def adapt_checkpoint(state_dict):
new_state_dict = {}
for k, v in state_dict.items():
if k.startswith('module.'):
state_dict[k[7:]] = v
del state_dict[k]
return state_dict
new_state_dict[k[7:]] = v
else:
new_state_dict[k] = v
return new_state_dict


################
Expand Down

0 comments on commit 3d7bcd6

Please sign in to comment.