Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hanmoi-choi/f9edca654ff88046416a9b3d4ad7151d to your computer and use it in GitHub Desktop.
Save hanmoi-choi/f9edca654ff88046416a9b3d4ad7151d to your computer and use it in GitHub Desktop.
Enabling Cuda for PyTorch in WSL2 env

Install Cuda toolkit in WSL2

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-4

Instal Pytorch supporting Cuda

pip3 install 'torch<2.1' torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment