Model.to('cuda:0') gets stuck

Hi! My program is getting stuck when I try to load resnet-18 on cuda. I tried torch.cuda.is_available() and it returns true. But I have not been able to load my model on cuda. It just gets stuck there. Could someone please help me with this?

Are you able to push tensors to the GPU?
Also, are you running the code in a terminal or Jupyter notebook etc.?

No. I am not able to push tensors to GPU. I tried running my code on the terminal as well as on jupyter notebook. It gives me the same problem. The program just gets stuck as soon as I call model.to(‘cuda:0’).

I think you have to call model.to(torch.device(‘cuda:0’)). is it possible?

Did you update your NVIDIA drivers recently? Could you restart your machine?
If that doesn’t help, could you try to run some CUDA examples and make sure your drivers are installed correctly?
Is nvidia-smi working properly?

I restarted the system but the problem still persists. nvidia-smi is working properly. Here’s the output :

Which CUDA version are you using?
Based on this chart you could only use CUDA versions < 9.0.
If you are using a newer CUDA version, could you try to update your drivers?