AttnGAN icon indicating copy to clipboard operation
AttnGAN copied to clipboard

Not being able to train on CPU even though I altered trainer.py

Open bjente opened this issue 5 years ago • 1 comments

In another issue about training on CPU, I read this fix:

"_trainer.py has lots of cuda() calls without asking about the CUDA flag set in config file, so evaluation/training on a CPU is not possible.

I fixed the issue by adding "if cfg.CUDA" loops before every cuda() call and it works just fine_"

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 Does anybody know how I can fix this please?

bjente avatar Apr 18 '19 09:04 bjente

Hi

In ./code/trainer.py line 36: if you change torch.cuda.set_device(cfg.GPU_ID) to torch.cuda.set_device(-1) it should work.

You're hardcoding it to use CPU mode though, so be aware.

melnyczuk avatar Jun 13 '19 17:06 melnyczuk