How to convert gpu trained model on cpu model

i trained model on google_colab, then i saved it with pickle(binary file), then i downloaded it and trying to open it, but can’t, i tried many things and nothing worked, here is example:

torch.load('better_model.pt', map_location=lambda storage, loc: storage)

model=torch.load('better_model.pt', map_location={'cuda:0': 'cpu'})

i don’t know meaning of this code, but it doesn’t work.please help

Can you tell us exactly what problem you have? Do you get an error message? If so, what it says? Please specify exactly what kind of bug you encounter, otherwise it will be hard to help you.

error asys:

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.

do you have any idea, how to load code, different from this code?

try

torch.load('better_model.pt', map_location=torch.device("cpu"))

i tried it :D, thanks, i will train it on cpu