From ef21ab9c91492c55323d1839a0a562b18d9b1687 Mon Sep 17 00:00:00 2001 From: Gnome Ann <> Date: Thu, 17 Mar 2022 14:10:51 -0400 Subject: [PATCH] PyTorch 1.9 lazy loader compatibility bugfix --- torch_lazy_loader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch_lazy_loader.py b/torch_lazy_loader.py index 36cdcf2c..09166f5a 100644 --- a/torch_lazy_loader.py +++ b/torch_lazy_loader.py @@ -195,7 +195,7 @@ def _load_from_state_dict(self, state_dict, prefix, local_metadata, strict, miss missing_keys.append(key) extra_state_key = prefix + _EXTRA_STATE_KEY_SUFFIX - if getattr(self.__class__, "set_extra_state", Module.set_extra_state) is not Module.set_extra_state: + if hasattr(Module, "set_extra_state") and getattr(self.__class__, "set_extra_state", Module.set_extra_state) is not Module.set_extra_state: # if getattr(self.__class__, "set_extra_state", Module.set_extra_state) is not Module.set_extra_state: if extra_state_key in state_dict: self.set_extra_state(state_dict[extra_state_key]) elif strict: