import os
os.environ["CUDA_VISIBLE_DEVICES"] = ""

Another option is to get a better traceback from the GPU. Add the following environment variable to the beginning of your code to get the traceback to point to the source of the error:

import os
os.environ["CUDA_LAUNCH_BLOCKING"] = "1"