Did you find any solution to this?
I was able to use the GPU with pytorch a couple of times before this error appeared magically one day.
Edit: I was able to solve the problem using the discussion here https://github.com/pytorch/pytorch/issues/17108 78
What worked for me was calling torch.cuda.current_device() before any cuda calls. For eg.
import torch
torch.cuda.current_device()
torch.cuda.is_available()

works but the opposite order of calls will not. Hope it helps!