Closed kaczmarj closed 2 years ago
Thanks!
@andrewilyas would it be possible to release a new version of the package on PyPI with this fix? Otherwise, the package can't be installed via PyPI for torchvision >=0.11.
@cassidylaidlaw - i agree that a new version should be uploaded but in the meantime you can install the project from github
pip install https://github.com/MadryLab/robustness/tarball/4033befe273b29f7b6dc36c30aa40696ed8fae96
that url returns a .tar.gz
file of the repository at the latest commit (4033befe273b29f7b6dc36c30aa40696ed8fae96), and pip can install that.
This replaces
with
Recent versions of torchvision no longer have that namespace, and a ModuleNotFoundError is raised.
I considered using a try-except block to try loading from one of those imports and then fallback to the other import. But I chose not to do that because other files already use the
torch.hub.load_state_dict_from_url
function. Those lines were added 2 years ago (eg https://github.com/MadryLab/robustness/commit/52a345bd46e09fc1f79a926048a40d6bf150618d). Because thetorch.hub
namespace has been used in other parts of the project for so long, it seems reasonable to me to simply replacetorchvision.models.utils
withtorch.hub
.