This error might point to a faulty driver installation, a failure in initializing the CUDA context or an unsupported GPU.
Was your setup working before or are you using a new environment/system?
In the former case, could you disable cudnn (torch.backends.cudnn.enabled=False), and run the code again?
Maybe some other error is hidden with this error message.