open your terminal,and enter the below
nvidia-smi
find the cuda version ,it must higher than the pytorch package version you installed
It’s best to create a new environment
create a virtual environment
conda create -n pytorch python=3.9
conda activate pytorch
install package
Refer to the installation
pytorch
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
install cuda
then unzip the file
install the cuda
install cudnn
u must choose the tarball version, and cuda version should suit for yourself
Unzip the file
Cut the files to the cuda files directory
Overwrite the original files
validation
import torch
torch.cuda.isavailable()
If it returns true
Congratulations, it worked!