Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

AttributeError: module 'torch._C' has no attribute '_cuda_getDevice #1

Closed
ronyuzhang opened this issue May 2, 2018 · 7 comments
Closed

Comments

@ronyuzhang
Copy link

i train my own data by using your checkpoint of checkpoint_unets , but have a error "AttributeError: module 'torch._C' has no attribute '_cuda_getDevice".
i train unet on cpu enviroment.

@pgtgrly
Copy link
Owner

pgtgrly commented May 2, 2018

I have made some changes, Can you pull the repository and test again? Please update me if it works or not.

@pgtgrly
Copy link
Owner

pgtgrly commented Jun 6, 2018

Closing as the issue is resolved

@pgtgrly pgtgrly closed this as completed Jun 6, 2018
@PeterXiaoGuo
Copy link

PeterXiaoGuo commented Jun 9, 2018

Hi, @pgtgrly

I face the same problem when I re-produce another code when I loading the .pt files.

I have no Nvidia GPU and run on a cpu only computer

Could you please share how you fix the "module 'torch._C' has no attribute '_cuda_getDevice" problem? Thank you very much!

Best,
Xiao

@pgtgrly
Copy link
Owner

pgtgrly commented Jun 9, 2018

Hey @PeterXiaoGuo
To load the GPU trained weights to CPU you will have to map them. This can be done by simply loading the model using:

model=torch.load(trained_model.pt,map_location={'cuda:0': 'cpu'})

You can find the same in my code here

Hope this helps.
Regards
PG

@PeterXiaoGuo
Copy link

Hey, @pgtgrly
Thank you very much!!!
I made it! Thank you !

Best,
Xiao

@pgtgrly
Copy link
Owner

pgtgrly commented Jun 9, 2018

@PeterXiaoGuo,
I am glad that I could help :)
Good Luck
PG

@ZangChaoyu
Copy link

我有GPU ,怎样解决呢请问

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants