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

Add CPU option (fix issue #23) #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kheimpel
Copy link

@kheimpel kheimpel commented Aug 8, 2018

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
Copy link

bjente commented Apr 17, 2019

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
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
Copy link

bjente commented Apr 23, 2019

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
Author

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

@bjente
Copy link

bjente commented Apr 23, 2019

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

@kheimpel
Copy link
Author

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

Sorry - has been a while...

@bjente
Copy link

bjente commented Apr 23, 2019

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