-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
torch.load non backwards compatible on Transformer between 1.8.1 and 1.9.0 #60165
Comments
And @gchanan #52537 (comment) - this might also be related to this issue. |
see https://pytorch.org/docs/stable/notes/serialization.html#id4 -- you should serialize the state_dict, not the module. |
Marking for triage review because I think we should really do something about https://pytorch.org/docs/stable/notes/serialization.html#id4 -- this is not the first time this has happened |
I think the doc is correct, though, right? It's just undiscoverable? |
https://pytorch.org/tutorials/beginner/saving_loading_models.html#save-load-entire-model is mentioning the risk in refactoring our own application but does not warn about the risk of Pytorch cross-version incompatibilities for PyTorch-provided model architectures. |
cc @brianjo for the tutorial update |
馃悰 Bug
A Transformer that I used
torch.save
on with Pytorch 1.8.1 cannot load on Pytorch 1.9.0.To Reproduce
Steps to reproduce the behavior:
On Pytorch 1.8.1:
Then update Pytorch to 1.9.0
The following stacktrace will show:
Expected behavior
torch.save()
on Pytorch X should be able to load modules that are saved on previous versions (#6801 (comment) says that torch.load is supposed to be backwards-compatible)In this specific case, redefining the
_LinearWithBias
module in torch.nn.modules.linear would solve the issue.Environment
conda
,pip
, source):pip
cc @mruberry
The text was updated successfully, but these errors were encountered: