dearleiii / PIRM-2018-SISR-Challenge

Super Resolution
https://www.pirm2018.org/PIRM-SR.html
2 stars 0 forks source link

load_state_dict state_dict = state_dict.copy() AttributeError: 'function' object has no attribute 'copy' #21

Closed dearleiii closed 6 years ago

dearleiii commented 6 years ago
leichen@gpu-compute3$ python3 load_model_test.py
Traceback (most recent call last):
  File "load_model_test.py", line 25, in <module>
    model1 = model1.load_state_dict(torch.load('/home/home2/leichen/SuperResolutor/Approx_discrim/model3/model3_2.pt', map_location = lambda storage, loc: storage)) #map_location={"cuda:0":cpu})
  File "/home/home2/leichen/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 695, in load_state_dict
    state_dict = state_dict.copy()
AttributeError: 'function' object has no attribute 'copy'
dearleiii commented 6 years ago

model.state_dict is a function, so very likely you want to call it as model.state_dict(). Best regards Thomas

mode.state_dict()