I am loading a pretrained model from an existing GitHub repository using “load_state_dict”, where the model gives and error as:
model_rgb = torch.load(‘eval/pretrained_models/RgbNet.pth’)
result = unpickler.load()
ImportError: No module named ‘numpy.core._multiarray_umath’
I searched for the error and found that it may be due to the torch version difference during training and now testing process.
Is it for sure that this is due to the versions difference?
The code I am using to load the model:
pretrained_models={'RgbNet':'eval/pretrained_models/RgbNet.pth', 'RgbdNet':'eval/pretrained_models/RgbdNet.pth' , 'DepthNet':'eval/pretrained_models/DepthNet.pth' }
result_path='crossdata_output/'
os.makedirs(result_path,exist_ok=True)

for tmp in ['D3Net']:
    os.makedirs(os.path.join(result_path,tmp),exist_ok=True)
    for test_dataset in test_datasets:
        os.makedirs(os.path.join(result_path,tmp,test_dataset),exist_ok=True)

model_rgb=RgbNet().cuda()


# model_rgb.load_state_dict(torch.load(pretrained_models['RgbNet'])['model'])

The code that saved the trained model
        if self.p['if_save_checkpoint']:
            torch.save(pth_state, os.path.join(self.p['snapshot_path'], 'checkpoint.pth'))
        if is_best:
            torch.save(pth_state, os.path.join(self.p['snapshot_path'], 'best.pth'))