median-research-group / LibMTL

A PyTorch Library for Multi-Task Learning
MIT License
1.94k stars 181 forks source link

Error while "from torchvision.models.utils import load_state_dict_from_url" #62

Closed ShuangWu-XDU closed 9 months ago

ShuangWu-XDU commented 9 months ago

the Dependencies says torchvision >= 0.9.0 but LibMTL/model/resnet.py print the error "No module named 'torchvision.models.utils'" at "from torchvision.models.utils import load_state_dict_from_url" my torchvision Version: 0.13.1+cu113, >= 0.9.0 Due to the version update of torchvision, the corresponding functions have been transferred to the new version of torch. Change this line of code to“from torch.hub import load_state_dict_from_url”, and the program will run normally I suggest adding a version judgment code while importing "load_state_dict_from_url"

Baijiong-Lin commented 9 months ago

We suggest using torchvision 0.9.1.

https://github.com/median-research-group/LibMTL/blob/5f81dfa76ea5e537c65eec3d84426fb25ad91182/requirements.txt#L12

ShuangWu-XDU commented 9 months ago

ok, sorry for missing that

Baijiong-Lin commented 9 months ago

We have modified the import code of load_state_dict_from_url to support the new version of torchvision. Thanks for your suggestion.