hongjiang-ye/ReID_PCB

test error load model

Closed this issue · 5 comments

yja1 commented

TypeError: 'str' object is not callable

error line: test.py
state_dict = torch.load(save_path, map_location='cpu')

It's hard to figure out where is the problem. Can you apply more details, like the error traceback, any changes from the code or your environment.

yja1 commented

state_dict = torch.load(save_path) #use this is OK

yja1 commented

in line utils.py load_network()

Did you test on CPU? What's your pytorch version (torch.__version__)?

Try to replace utils.py line 38 state_dict = torch.load(save_path, map_location='cpu') with:
state_dict = torch.load(save_path, map_location=lambda storage, loc: storage)

yja1 commented

thx.
state_dict = torch.load(save_path, map_location=lambda storage, loc: storage)
and state_dict = torch.load(save_path) is ok