Saving torch models

I have no idea when are you getting the first error and what does it mean. I’ve never seen that.

About the second thing, the problem with saving modules is that they will break if you move the model code into a different file or directory, because they don’t save the class, but a path where pickle will try to look it up at load time. I’d recommend using state_dict() for serialization and load_state_dict() for reloading the weights.

2 Likes