You need to download the version of Pytorch that is compatible with CUDA for that, head over to the website: https://pytorch.org/
Download the latest one (12.4) and Run the command that is shown in the image on your Command Terminal.
Then Install Cuda same version (12.4) URL: https://developer.nvidia.com/cuda-12-4-0-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_local
Then check the commands,
Nvidia-smi
nvcc --version
Ensure the versions for Pytorch & CUDA are same, Hope this helps!