Torch.load()return False

When I test torch.cuda.available(), it returns True.
But when I use torch.load(), it tells me torch.cuda.available() is False:

File “D:\Anaconda3\envs\charm\lib\site-packages\torch\serialization.py”, line 115, in validate_cuda_device
raise RuntimeError('Attempting to deserialize object on a CUDA ’
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device(‘cpu’) to map your storages to the CPU.

Why?

Are you trying to load the model directly or the state_dict?
Could you push the model or state_dict to the CPU before storing it, load it in another script, and try to push it to the device later?
If this is working, the torch.load method might create the issue and would help us to debug it.