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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError("{} is a zip archive (did you mean to use torch.jit.load()?)".format(f.name)) when loading model weights #43766
Comments
Hi feiyangsuo, You are right that it is indeed a zip file. See PyTorch 1.6 release notes about the change (search for "zip" in the linked webpage). I would suggest upgrading to 1.6 and the issue should be gone. If that's not the case, please update the bug and we will investigate. Or if you have reasons to not upgrade to 1.6, let us know and we will see what we can do. Thanks, |
@ gmagogsfm |
good to hear! :) |
I have an exactly same issue, except that my model is trained on torch version 1.6.0, and I tried to load in version 1.6.0 as well. Requesting for an reopen.
Triggered by
|
I cannot update due to hardware reasons (using ibm ppc64le architecture). What is the solution? |
I have the same issue with 1.7.0 by using The error message suggests to use Any updates? |
pytorch1.6 and later change the save file to zip file, you can use a higher version (>=1.6) to load the weight.pt and re-save by using
|
I'm using pytorch 1.5. There's a weight file "best.pt" which is trained within pytorch 1.6. When I try to load the weights the error raises as
RuntimeError: best.pt is a zip archive (did you mean to use torch.jit.load()?)
.The file can be naomally loaded in pytorch 1.6 using torch.load().
It doesn't work if I use torch.jit.load() to load the file. In this circumstance there's another error:
RuntimeError: version_number <= kMaxSupportedFileFormatVersion ASSERT FAILED at ..\caffe2\serialize\inline_container.cc:131, please report a bug to PyTorch. Attempted to read a PyTorch file with version 3, but the maximum supported version for reading is 1. Your PyTorch installation may be too old. (init at ..\caffe2\serialize\inline_container.cc:131) (no backtrace available)
I followed this conversation which suggests to manually implement
is_zipfile
, but the new function still judges "best.pt" as a zip file. In debug mode I saw it's true that the "magic number" appears in the first 4 bytes. So does it mean that this weight file is truely a zip file?Then I wonder if the problem is caused by version confliction? Like, I should upgrade my pytorch version to 1.6 so that the problem is naturally gone?
cc @gmagogsfm
The text was updated successfully, but these errors were encountered: