Skip to content

Commit 8c48b20

Browse files
authored
Merge pull request #121
fix the bug of the optimizer state saving
2 parents 0ee443a + d5de2df commit 8c48b20

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plsc/utils/io.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ def _optimizer_state_dict_split(state_dict):
108108
dist_state_dict['param_groups'].append(group)
109109
state_dict['param_groups'].remove(group)
110110
for name in group['params']:
111-
dist_state_dict['state'][name] = state_dict['state'].pop(name)
111+
if name in state_dict['state']:
112+
dist_state_dict['state'][name] = state_dict['state'].pop(
113+
name)
112114
return state_dict, dist_state_dict
113115

114116

0 commit comments

Comments
 (0)