Skip to content

Commit

Permalink
Fix load_state_dict() to handle None layer LRs
Browse files Browse the repository at this point in the history
  • Loading branch information
DubiousCactus committed Jul 30, 2022
1 parent c4ea713 commit 811beb0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion learn2learn/optim/transforms/layer_step_lr_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def load_state_dict(self, lr_state_dicts: Dict[str, Dict[str, Any]]):
type(lr_state_dicts) is dict
), "Argument lr_state_dicts must be a dictionary!"
for layer_name, state_dict in lr_state_dicts.items():
self._lslr[layer_name].load_state_dict(state_dict)
if self._lslr[layer_name] is not None:
self._lslr[layer_name].load_state_dict(state_dict)

def state_dict(self) -> Dict[str, Optional[Dict[str, Any]]]:
return {
Expand Down

0 comments on commit 811beb0

Please sign in to comment.