Skip to content

Add CPU option (fix issue #23)#24

Open
kheimpel wants to merge 1 commit into
taoxugit:masterfrom
kheimpel:master
Open

Add CPU option (fix issue #23)#24
kheimpel wants to merge 1 commit into
taoxugit:masterfrom
kheimpel:master

Conversation

@kheimpel

@kheimpel kheimpel commented Aug 8, 2018

Copy link
Copy Markdown

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

Added "if CUDA" to all cuda() calls
@bjente

bjente commented Apr 17, 2019

Copy link
Copy Markdown

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?

@kheimpel

Copy link
Copy Markdown
Author

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?

@bjente

bjente commented Apr 23, 2019

Copy link
Copy Markdown

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

@kheimpel

Copy link
Copy Markdown
Author

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

@bjente

bjente commented Apr 23, 2019

Copy link
Copy Markdown

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

@kheimpel

Copy link
Copy Markdown
Author

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

Sorry - has been a while...

@bjente

bjente commented Apr 23, 2019

Copy link
Copy Markdown

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

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

Successfully merging this pull request may close these issues.

2 participants