sc_depth_pl icon indicating copy to clipboard operation
sc_depth_pl copied to clipboard

AttributeError: module 'torchvision.models.resnet' has no attribute 'model_urls'

Open hunterwn opened this issue 1 year ago • 1 comments

As of torchvision version 0.15.0 the 'resnet' module no longer contains the attribute 'model_urls' referenced in resnet_encoder.py.

This error was fixed by downgrading my torchvision to 0.14.1, but anyone trying to run this script should be aware that the latest versions of torchvision will no longer work.

hunterwn avatar May 18 '23 17:05 hunterwn

I have the same issue on torchvision 0.15.0. Here is how I solve the problem:

If you are using resnet18 for example, you can replace the original code like loaded = torch.hub.load_state_dict_from_url(models.ResNet18_Weights.IMAGENET1K_V1.url) in resnet_encoder.py

The url is embedded in resnet weight object.

renyiyu avatar May 26 '23 08:05 renyiyu