Skip to content

Commit 832b165

Browse files
sharvilfacebook-github-bot
authored andcommitted
Fix missing attribute when loading model from older version (#42242) (#42290)
Summary: Fixes #42242 Pull Request resolved: #42290 Reviewed By: VitalyFedyunin Differential Revision: D22844096 Pulled By: albanD fbshipit-source-id: 707e552e0ed581fbe00f1527ab7426880edaed64
1 parent 4c6878c commit 832b165

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

torch/nn/modules/module.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ def __setstate__(self, state):
758758
self._state_dict_hooks = OrderedDict()
759759
if '_load_state_dict_pre_hooks' not in self.__dict__:
760760
self._load_state_dict_pre_hooks = OrderedDict()
761+
if '_non_persistent_buffers_set' not in self.__dict__:
762+
self._non_persistent_buffers_set = set()
761763

762764
def __getattr__(self, name: str) -> Union[Tensor, 'Module']:
763765
if '_parameters' in self.__dict__:

0 commit comments

Comments
 (0)