AssertionError: Torch not compiled with CUDA enabled
时间: 2023-10-26 13:42:45 浏览: 92
This error occurs when the PyTorch library was not compiled with CUDA enabled, which means that PyTorch cannot use the GPU for computations.
To fix this error, you can try reinstalling PyTorch with CUDA enabled. Make sure you have a compatible version of CUDA installed on your system. You can check the PyTorch website for the specific CUDA version required for your version of PyTorch.
If you are using a pre-built package of PyTorch, you may need to download a different package that supports CUDA.
Another option is to use the CPU instead of the GPU for computations by setting the device to "cpu" in your PyTorch code. However, this will significantly slow down the training process.
阅读全文