RuntimeError: CUDA unknown error

RuntimeError: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero.

I need your help on how above issues should be resolved

Based on the error message it seems that your setup is unable to initialize the CUDA context, which could be caused by e.g. a faulty driver installation, a driver update without restarting the node, using the “sleep/hibernate” mode in Linux etc.
Was this setup working before at one point or is this a new setup?

Thank you a lot for your help.
My laptop model is Xiaomi Redmibook 16.
I am running above code in pycharm 2021.2, python 3.9. At the beginning it display no NVIDIA Graphic driver and i install NVIDIA GeForce 610M. It didn’t work before.

The GeForce 610M is a Fermi GPU with compute capability 2.1, so it’s not supported anymore as it’s too old. You could try out e.g. Google Colab with the free GPU runtime instead.

Thank you a lot. I really appreciate it. let me try it.