Loading models in pytorch

Hi,

I have understood that we need to do the following for loading models in pytorch

checkpoint = torch.load(opt.model, map_location=lambda storage, loc: storage)

However, my models are in Torch. So instead of load I do the following:

from torch.utils.serialization import load_lua
checkpoint = torch.load_lua(opt.model)

However, this does not lead to automatic assignment of devices. Right? Is there a way out?

You should look at this topic: Convert/import Torch model to PyTorch

So far, there is no clean way to do it, but you can probably do some hacks to make it.

1 Like