install CUDA Toolkit

first, from CUDA Toolkit Archive to choose CUDA Toolkit to download.

we choose the version: CUDA Toolkit 12.4.1.

1
2
3
4
5
6
❯ nvcc  --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:30:10_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0

install cuDNN

from cuDNN Archive to choose cuDNN to download.

we choose the version: cuDNN 9.1.0.

install pytorch

Get pip cmd from Installing previous versions of PyTorch

we choose torch==2.4.0:

1
pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu124

Check GPU(cuda):

1
2
3
4
>>> import torch
>>> torch.cuda.is_available() 
True
>>>