Can't get attribute _rebuild_parameter on module torch._utils

when i load my model
model,optimizer = model.load_checkpoint(‘resnet50-transfer-4.pt’)
that error appear

AttributeError Traceback (most recent call last)
in ()
1
----> 2 model,optimizer = model.load_checkpoint(‘resnet50-transfer-4.pt’)

/home/workspace/cnnnetwork.py in load_checkpoint(self, path)
295
296 # Load in checkpoint
–> 297 checkpoint = torch.load(path)
298
299 if model_name == ‘vgg16’:

/opt/conda/lib/python3.6/site-packages/torch/serialization.py in load(f, map_location, pickle_module)
301 f = open(f, ‘rb’)
302 try:
–> 303 return _load(f, map_location, pickle_module)
304 finally:
305 if new_fd:

/opt/conda/lib/python3.6/site-packages/torch/serialization.py in _load(f, map_location, pickle_module)
467 unpickler = pickle_module.Unpickler(f)
468 unpickler.persistent_load = persistent_load
–> 469 result = unpickler.load()
470
471 deserialized_storage_keys = pickle_module.load(f)

AttributeError: Can’t get attribute ‘_rebuild_parameter’ on <module ‘torch._utils’ from ‘/opt/conda/lib/python3.6/site-packages/torch/_utils.py’>

I am having same issue too. Please can someone help

you are trying to load a newer checkpoint in an older version of PyTorch. For example you saved your ‘resnet50-transfer-4.pt’ in PyTorch 1.0.0 while loading it in 0.3.1.

We support backward-compatibility, but not forward compatibility, and this is not expected to work.

3 Likes

Yes Yes, i figure. i was trying to load model trained with pytorch 1.0 on a 0.4.0