-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Pretrained efficientnet_b0_rwrightman-3dd342df state_dict fails sha256 check #7744
Comments
Thanks for the report @ptrblck . I'll take a look on the S3 bucket and see if the file has changed. It would be strange though, I suspect / hope it was just a typo we introduced originally |
hi @NicolasHug any progress on this ? |
Hmm, it was last modified in Aug 2021:
[Edit] Torchvision checked out at 2925df7 works, but latest trunk 29418e3 fails [Edit2] #7219 added sha-sum checks, but I guess we've never validated that it is correct. |
@ptrblck bingo :) So it was like that for a while, but it was not checked before... Running the script to validate published checksums right now... |
Thanks a lot all for the reports and investigations. I re-uploaded the weights with the proper hashes on S3 and also fixed the URL in #7898. |
I can still reproduce this issue with @NicolasHug, running your script from #7898 I get:
|
Thanks for the report @ar0ck . I'm confused as to how I missed those in the past, but I can reproduce... We'll fix those in the next [bugfix] release |
Thanks for the effort. Any workaround to fix it temporarily? |
EDIT: This is fixed in torchvision 0.17, just install "torchvision>0.16" and this should be fixed. If you're stuck with 0.16, do as described below Original comment: Overriding from torchvision.models import efficientnet_b0, EfficientNet_B0_Weights
from torchvision.models._api import WeightsEnum
from torch.hub import load_state_dict_from_url
def get_state_dict(self, *args, **kwargs):
kwargs.pop("check_hash")
return load_state_dict_from_url(self.url, *args, **kwargs)
WeightsEnum.get_state_dict = get_state_dict
efficientnet_b0(weights=EfficientNet_B0_Weights.IMAGENET1K_V1)
efficientnet_b0(weights="DEFAULT") |
Overriding torchvision.models._api.WeightsEnum.get_state_dict() did it , thank you . |
Guys, an error started to occur when loading the model. A week ago everything was loading well model = efficientnet_b6(pretrained=True) RuntimeError: invalid hash value (expected "c76e70fd", got "24a108a596a00ad522bdfb9a2d98a9bd31819dfd7e37dd96bad6bb5bc00d6015") |
@dimakpa please see #7744 (comment) until the fix is available in the next bugfix release (planned for mid Nov) |
Thank you very much! Looking forward to the final solution. |
What is |
It's an attribute of the
|
For anyone who might still be stuck with the same error. The major issue is from
|
I had similar problem when running code in Jupyter Notebook. I could download efficientnet_b3 model by PyCharm without any issue I installed torchvision version 0.15.2 for Jupyter Notebook and ran the same model loading. I got error message: RuntimeError: invalid hash value (expected "cf984f9c", got "b3899882250c22946d0229d266049fcd133c169233530b36b9ffa7983988362f" |
@winnie128 please install a more up-to-date version of torchvision |
Problem was solved after torchvision version 0.18.0 installed. Thanks! |
🐛 Describe the bug
Originally reported in the forum.
I am able to reproduce the issue using
torchvision==0.16.0.dev20230709+cu121
:Downloading the
state_dict
manually also confirms thesha256
checksum:which does not match the one stored in the file name.
Versions
torchvision==0.16.0.dev20230709+cu121
The text was updated successfully, but these errors were encountered: