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

'name 'Unet34' is not defined' - How to run code on CPU? #28

Closed
AlexanderKozhevin opened this issue Nov 7, 2018 · 1 comment
Closed

Comments

@AlexanderKozhevin
Copy link

As far as I got it right, this class is related to CUDA.
But how can I run it on CPU ?
I disabled this line of code.

#torch.cuda.set_device(0)
@jantic
Copy link
Owner

jantic commented Nov 7, 2018

Soo...I tried this before as well, namely because i wanted to see if I could run bigger images (more memory with CPU of course).

The way to really force CPU is putting this up top in the notebook before the pytorch related imports:

import os
os.environ['CUDA_VISIBLE_DEVICES'] = ''

When I tried that myself, it seemed to have done the trick, but then the processing was super slow and I just abandoned the effort in the meantime. The reason why I abandoned it was because I looked up the CPU performance issue and the man himself (Soumith Chintala) said this:

@Zhangchenkai you will see great improvement if you build from source from these instructions: https://github.com/pytorch/pytorch#from-source

The instructions will build and link with mkl-dnn and that will show you remarkable improvements to what you see.

pytorch/pytorch#9873

I think that's probably the issue I saw. I didn't go ahead and build from source because it wasn't pressing and I'm a bit lazy. You could try it...I just don't know for certain if that's actually the issue.

Please, if you're so inclined and do try it out, please let me know! We can put it in the readme then because that'll probably be helpful to a lot of people.

@jantic jantic closed this as completed Nov 7, 2018
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