Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to load weights #3

Closed
faroit opened this issue Jan 15, 2018 · 2 comments
Closed

unable to load weights #3

faroit opened this issue Jan 15, 2018 · 2 comments

Comments

@faroit
Copy link

faroit commented Jan 15, 2018

I get the following error when running test_network.py:

Traceback (most recent call last):
  File "test_network.py", line 11, in <module>
    model.initialize(model='net-lin',net='alex',use_gpu=False)
  File "/Users/faro/repositories/PerceptualSimilarity/models/dist_model.py", line 38, in initialize
    self.net.load_state_dict(torch.load('./weights/%s.pth'%net, map_location=lambda storage, loc: 'cpu'))
  File "/Users/faro/repositories/PerceptualSimilarity/.env/lib/python3.6/site-packages/torch/serialization.py", line 261, in load
    return _load(f, map_location, pickle_module)
  File "/Users/faro/repositories/PerceptualSimilarity/.env/lib/python3.6/site-packages/torch/serialization.py", line 409, in _load
    result = unpickler.load()
  File "/Users/faro/repositories/PerceptualSimilarity/.env/lib/python3.6/site-packages/torch/_utils.py", line 74, in _rebuild_tensor
    module = importlib.import_module(storage.__module__)
AttributeError: 'str' object has no attribute '__module__'

To get there I needed to change a few files and fixing some import bugs
One thing that would really help to reproduce the results if you could specify the requirements (especially the pytorch version). Maybe consider adding a requirements file like I did here: See my fork here: faroit@4ccefee#diff-b4ef698db8ca845e5845c4618278f29a

@faroit
Copy link
Author

faroit commented Feb 23, 2018

ping @richzhang

@richzhang
Copy link
Owner

Thanks for the suggestion and sorry for the slow response. I added code to fix the path of the weights. I also added a requirements file.

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants