Copying a model

I’m working on multiple remote machines, which share a directory (minIO)
In one of them, I have a trained model named, I’ve moved it into the minIO using the Linux cp command, then copied it yet again to the other machine, now when I try to load the model using:
model = torch.load(hyper_params['model_path'])

I’m getting the error:
Exception has occurred: RuntimeError Invalid magic number; corrupt file?

Thanks in advance.


If the hyper_params['model_path'] is the output of, path), it would difficult to load that file in other directories as explained in the tutorial:

The disadvantage of this approach is that the serialized data is bound to the specific classes and the exact directory structure used when the model is saved. (quote from Saving and Loading Models — PyTorch Tutorials 1.8.0 documentation)

The recommended way is to save/load state_dict (Saving and Loading Models — PyTorch Tutorials 1.8.0 documentation).