-
Notifications
You must be signed in to change notification settings - Fork 54
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
AttributeError: module 'torch.hub' has no attribute 'get_dir' #22
Comments
I think this is because of the version. What is your version of pytorch? |
Pytorch 1.4.0, torchvision 0.5.0, cuda 10.0, python 3.6 |
After checking the official documents between 1.4.0 and 1.8.1, I found that |
I tried torch.hub.set_dir('dir') However, another error occured, as the following shows. File "/home/yyz/anaconda3/envs/hawp/lib/python3.6/site-packages/torch/hub.py", line 501, in load_state_dict_from_url It seems that the error is also related to the pytorch version. But, the version 1.8.1 cannot be installed when cuda version is 10.0. May I ask which version of cuda and which version of pytorch are used in the code? Shall I change my cuda version to 10.1? |
Let me fix the bug tomorrow
ylxbyy ***@***.***>于2021年8月31日 周二下午10:10写道:
… After checking the official documents between 1.4.0 and 1.8.1, I found
that torch.hub.hub_dir() was changed to torch.hub.get_dir()
I tried torch.hub.hub_dir() in the version 1.4.0, but error occurred
(TypeError: 'str' object is not callable). Then I tried set_dir() and
hub_dir together and it worked.
torch.hub.set_dir('dir')
hubdir = torch.hub.hub_dir
However, another error occured, as the following shows.
File
"/home/yyz/anaconda3/envs/hawp/lib/python3.6/site-packages/torch/hub.py",
line 501, in load_state_dict_from_url
raise RuntimeError('Only one file(not dir) is allowed in the zipfile')
RuntimeError: Only one file(not dir) is allowed in the zipfile
It seems that the error is also related to the pytorch version. But, the
version 1.8.1 cannot be installed when cuda version is 10.0. May I ask
which version of cuda and which version of pytorch are used in the code?
Shall I change my cuda version to 10.1?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#22 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC63FDYFMKOKLFJRLO7QRALT7TPEPANCNFSM5DDS7P5Q>
.
|
Thank you for your help. I didn't solve the 'RuntimeError: Only one file(not dir) is allowed in the zipfile' error in my previous environment. Finally, I changed my environment to: python 3.7, cuda 10.1, pytorch 1.8.1, and successfully predicted images with the original codes. |
Hello~
Thanks for the nice work.
When I use the 'hawp/src/predict.py' code to predict new images, I met the following error. I checked the attributes in torch.hub, seeing that 'get_dir' does not exist and there are some other similar attributes e.g. 'set_dir()', 'hub_dir'. I have tried other attributes but still failed in loading the pretrained model.
File "/home/yyz/hawp/parsing/detector.py", line 430, in get_hawp_model
hubdir = torch.hub.get_dir()
AttributeError: module 'torch.hub' has no attribute 'get_dir'
Could you please give me some suggestions in dealing with the problem?
The text was updated successfully, but these errors were encountered: