What worked for me was:
pip uninstall torch
pip cache purge
pip install torch torchvision --pre -f https://download.pytorch.org/whl/nightly/cu121/torch_nightly.html
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
Cuda version with returned 12.1 with this command
nvidia-smi.exe
pip list | grep torch
returns this list
pytorch-lightning 1.6.4
torch 2.0.1+cu117
torchaudio 2.0.2
torchmetrics 0.9.2
torchvision 0.15.2+cu117
and
import torch
torch.cuda.is_available()
returns ‘True’
not sure if this is relevant, but i was running whisper and whisper was forcing cpu, now it works fine