AssertionError: Torch not compiled with CUDA enabled

この記事は約1分で読めます。

関連するエラー

AttributeError: module 'torch._C' has no attribute '_cuda_setDevice'

環境

  • Windows 10
  • python 3.6
  • その他CUDA, cudnn, pytorchなど
  • GPU NVIDIA GeForce GTX1080 Ti

解決法

以下のエラーが発生。

Torch not compiled with CUDA enabled

調べると、pytorchのGitHubに有益なコメントを発見。

AssertionError: Torch not compiled with CUDA enabled · Issue #30664 · pytorch/pytorch
I'm trying to do neural style swapping, and for some reason, I keep getting the following errors. AssertionError: Torch not compiled with CUDA enabled File "c:\...

このコマンドを実行するとGPUを認識するようになった。

pip install torch===1.5.0 torchvision===0.6.0 -f https://download.pytorch.org/whl/torch_stable.html