[Solved] Cuda error: unknown error

I am getting this error very frequently and I don’t know how to solve it. I read somewhere that I have to update graphic driver and I’ve done it and restart my laptop but again getting this error.
Is it some sort of bug or what please help me out.

P.S I am using windows

Could you post some information on your current setup (i.e. which GPU, driver version, CUDA, cudnn version etc.)?

Were you able to use the GPU before or do you always encounter this issue?

Driver Version
CUDA version 10.0

And yes it used to work before but sometimes it used to give same error

According to the driver version, it should be ~430.xx?

Since you are using a laptop, could you check some Windows energy saving options, which might deactivate the GPU?

Charger is plugged in and it is working on best performance.
Please help me out I can’t work on my projects.

Could you try to set num_workers=0 and pin_memory=False in your DataLoader?
In the past this error was often solved by upgrading the driver, restarting etc., as you already said.

Okay that did work for dataloader but I still can’t move my model to GPU, it’s showing same error.

What does it mean?
Are you able to push tensors now onto the GPU, but not the model?

I think anything related to cuda is not working as I can’t push anything on GPU

And it is working properly in command prompt

That’s good to know.
Did you start this REPL session using python or ipython?
I assume IPython might yield these problems.

Could you create a new conda environment and install PyTorch and all other dependencies there?

As you said I created new conda environment then tweaked some of my settings in NVIDIA control panel and voila it started to work. Thanks for all the help.