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,我的問題就解決了。