Error in loading pre training weight in torch. Load() in pytorch

I trained a model with GPU. I want to make an error when loading the test locally (only CPU):

    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.

According to the prompt, add to torch. Load()  map_ Location = torch. Device ('cpu ') parameter

 

Similar Posts: