AttnGAN icon indicating copy to clipboard operation
AttnGAN copied to clipboard

Add CPU option (fix issue #23)

Open kheimpel opened this issue 6 years ago • 7 comments

Added "if CUDA" to all cuda() calls in trainer.py Makes it possible to evaluate & train on CPU

kheimpel avatar Aug 08 '18 12:08 kheimpel

This fix still doesn't enable me to evaluate and train on CPU... I keep on getting this error: AttributeError: module 'torch._C' has no attribute '_cuda_getDevice Do you know how to fix it?

bjente avatar Apr 17 '19 20:04 bjente

This fix still doesn't enable me to evaluate and train on CPU... I keep on getting this error: AttributeError: module 'torch._C' has no attribute '_cuda_getDevice Do you know how to fix it?

Could you please provide filename and line number?

kheimpel avatar Apr 22 '19 16:04 kheimpel

Traceback (most recent call last): File "main.py", line 136, in algo = trainer(output_dir, dataloader, dataset.n_words, dataset.ixtoword) File "/Users/bentedebruin/Documents/AttnGAN/code/trainer.py", line 36, in init torch.cuda.set_device(cfg.GPU_ID) File "/Users/bentedebruin/miniconda3/lib/python3.7/site-packages/torch/cuda/init.py", line 264, in set_device torch._C._cuda_setDevice(device) AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'

This is the error I'm getting when I put this in command line: python main.py --cfg cfg/eval_coco.yml

bjente avatar Apr 23 '19 09:04 bjente

Did you set GPU_ID = 0 in your config file (eval_coco.yml)?

kheimpel avatar Apr 23 '19 13:04 kheimpel

I just did, but I get the exact same error. Same filenames and line numbers...

bjente avatar Apr 23 '19 13:04 bjente

Ok. Please try GPU_ID = -1 in your yml file.

Sorry - has been a while...

kheimpel avatar Apr 23 '19 14:04 kheimpel

Thank you so much! I don't get that error anymore!!! :)

bjente avatar Apr 23 '19 15:04 bjente