AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'(在python命令後面加上 --gpu_ids -1)

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章