Skip to content
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

How to solve this error? When I run this net to predict an image,I have GPU,But I want not to use it. #20

Closed
CachCheng opened this issue Apr 10, 2020 · 2 comments

Comments

@CachCheng
Copy link

RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu
Traceback:
File "/data/User/ch/CNN/view/image_app.py", line 80, in matting_view
alpha = matting.predict(image, trimap)
File "/root/anaconda3/lib/python3.7/site-packages/graphics/function/Matting.py", line 81, in predict
outputs = self.net(inputs).squeeze().cpu().data.numpy()
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 146, in forward
"them on device: {}".format(self.src_device_obj, t.device))

@poppinace
Copy link
Owner

Inferrence on the CPU is slow. You need to transfer the weight to CPU. I should have commented a line of code where model is loaded. Please double check.

@CachCheng
Copy link
Author

OK,I have solved this error, Thank you!,I will close it!

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

No branches or pull requests

2 participants