Skip to content

Commit

Permalink
Fix model saving for older versions of PyTorch, see #71
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Dec 20, 2023
1 parent d36d227 commit 2c3b533
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mogptk/gpr/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def compile(self):
self._compiled_forward = torch.jit.trace(self.forward, ())

def __getstate__(self):
state = super().__getstate__()
state = self.__dict__.copy()
state.pop('_compiled_call_impl', None)
state['_modules'] = state['_modules'].copy()
state['_modules'].pop('_compiled_forward', None)
return state
Expand Down

0 comments on commit 2c3b533

Please sign in to comment.