1. 问题:AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'
运行命令python train.py --data_dir sample_data时,出现上述错误。
2. 参考:
https://github.com/KupynOrest/DeblurGAN/issues/74 从这里知道了下一个链接
https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/issues/67 有一个解决办法:
https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/issues/360
3. 解决:
我安装的Pytorch时cpu版本的,不是gpu版本的。所以,需要在python命令后面加上 --gpu_ids -1,问题解决。
那么,运行命令:python train.py --data_dir sample_dataset --gpu_ids -1,我的问题就解决了。
或者,也可以在文件中,直接把参数gpu_ids的默认值改成-1。如下图所示,也可以解决问题。