Pretrained efficientnet_b0_rwrightman-3dd342df state_dict fails sha256 checkΒ #7744
Closed
Description
π Describe the bug
Originally reported in the forum.
I am able to reproduce the issue using torchvision==0.16.0.dev20230709+cu121
:
model = models.efficientnet_b0(pretrained=True)
/home/pbialecki/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
warnings.warn(
/home/pbialecki/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=EfficientNet_B0_Weights.IMAGENET1K_V1`. You can also use `weights=EfficientNet_B0_Weights.DEFAULT` to get the most up-to-date weights.
warnings.warn(msg)
Downloading: "https://download.pytorch.org/models/efficientnet_b0_rwightman-3dd342df.pth" to /home/pbialecki/.cache/torch/hub/checkpoints/efficientnet_b0_rwightman-3dd342df.pth
100%|ββββββββββ| 20.5M/20.5M [00:00<00:00, 52.8MB/s]
Traceback (most recent call last):
Cell In[75], line 1
model = models.efficientnet_b0(pretrained=True)
File ~/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torchvision/models/_utils.py:142 in wrapper
return fn(*args, **kwargs)
File ~/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torchvision/models/_utils.py:228 in inner_wrapper
return builder(*args, **kwargs)
File ~/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torchvision/models/efficientnet.py:770 in efficientnet_b0
return _efficientnet(
File ~/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torchvision/models/efficientnet.py:360 in _efficientnet
model.load_state_dict(weights.get_state_dict(progress=progress, check_hash=True))
File ~/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torchvision/models/_api.py:90 in get_state_dict
return load_state_dict_from_url(self.url, *args, **kwargs)
File ~/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torch/hub.py:757 in load_state_dict_from_url
download_url_to_file(url, cached_file, hash_prefix, progress=progress)
File ~/miniforge3/envs/nightly_pip_cu121/lib/python3.10/site-packages/torch/hub.py:653 in download_url_to_file
raise RuntimeError('invalid hash value (expected "{}", got "{}")'
RuntimeError: invalid hash value (expected "3dd342df", got "7f5810bc96def8f7552d5b7e68d53c4786f81167d28291b21c0d90e1fca14934")
Downloading the state_dict
manually also confirms the sha256
checksum:
wget https://download.pytorch.org/models/efficientnet_b0_rwightman-3dd342df.pth
sha256sum efficientnet_b0_rwightman-3dd342df.pth
7f5810bc96def8f7552d5b7e68d53c4786f81167d28291b21c0d90e1fca14934 efficientnet_b0_rwightman-3dd342df.pth
which does not match the one stored in the file name.
Versions
torchvision==0.16.0.dev20230709+cu121