Pytorch-cyclegan-and-pix2pix: How do I fix this?

Created on 25 Jul 2017  ·  10Comments  ·  Source: junyanz/pytorch-CycleGAN-and-pix2pix

I am running this on a Mid 2011 IMac OSX 10.10, and so far everything has run smoothly. I am at this step in the instructions:
python train.py --dataroot ./datasets/maps --name maps_cyclegan --model cycle_gan --no_dropout

And I get this as a result:
Traceback (most recent call last):
File "train.py", line 7, in
opt = TrainOptions().parse()
File "/Users/samuellevin/vision/pytorch-CycleGAN-and-pix2pix/options/base_options.py", line 60, in parse
torch.cuda.set_device(self.opt.gpu_ids[0])
File "/Users/samuellevin/anaconda3/lib/python3.6/site-packages/torch/cuda/__init__.py", line 161, in set_device
torch._C._cuda_setDevice(device)
AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'

How do I fix this?

Most helpful comment

Try running on CPU by adding the following option: --gpu_ids -1

All 10 comments

I wonder if you have installed the Pytorch with CUDA support. What's the GPU in your iMac?

Try running on CPU by adding the following option: --gpu_ids -1

"--gpu_ids -1" doesn't work on mac sadly...

I tried --gpu -1 but I still get the same error.

any news on this?

Changing the line to:
torch._C._cuda_setDevice(-1)
worked for me.

请问在windows中怎样解决AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'

cuda error
Hey guys!
I am using windows 10 with only CPU and getting the error mentioned in the screenshot.
How to fix it?
Thank you.

Not sure. It seems to be related to PyTorch. You could post/find the issue on the PyTorch repo.

Thank you so much for your suggestion let me go through on pytorch repo.

cuda error
Hey guys!
I am using windows 10 with only CPU and getting the error mentioned in the screenshot.
How to fix it?
Thank you.

hey!
were u able to figure out what the problem you had was?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheIllusion picture TheIllusion  ·  5Comments

zerxon picture zerxon  ·  4Comments

shivom9713 picture shivom9713  ·  4Comments

nootfly picture nootfly  ·  4Comments

lyhangustc picture lyhangustc  ·  5Comments