taoxugit / AttnGAN

MIT License
1.34k stars 420 forks source link

trainer.py not working with CPU #23

Open kheimpel opened 6 years ago

kheimpel commented 6 years ago

Hi,

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: https://github.com/KCool/AttnGAN/blob/master/code/trainer.py

Best KCool