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

vgg16_features.load_state_dict(torch.load(vgg_path), strict=False) #10

Closed
mrlogick opened this issue Feb 3, 2020 · 4 comments
Closed

Comments

@mrlogick
Copy link

mrlogick commented Feb 3, 2020

I have no issues with stylize.py (with pretrained models). My problem is with train.py. I think I followed the instructions: downloaded vgg16-00b39a1b.pth, downloaded train2014, installed pytorch, opencv, etc (installed with conda).
I have Debian 11 stable, Python 3.7.4, pytorch 1.4.0, torchvision 0.5.0, cudatoolkit 10.1.243.

$ python train.py

Traceback (most recent call last):
  File "train.py", line 168, in <module>
    train()
  File "train.py", line 50, in train
    VGG = vgg.VGG16().to(device)
  File "/home/mrfabiolo/style_transfer/fast-neural-style-pytorch/vgg.py", line 33, in __init__
    vgg16_features.load_state_dict(torch.load(vgg_path), strict=False)
  File "/home/mrfabiolo/miniconda3/lib/python3.7/site-packages/torch/serialization.py", line 529, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/mrfabiolo/miniconda3/lib/python3.7/site-packages/torch/serialization.py", line 692, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

Same problem with device = "cpu" or device = "cuda". I got a GeForce GTX 750 card.

@rrmina
Copy link
Owner

rrmina commented Feb 3, 2020 via email

@mrlogick
Copy link
Author

mrlogick commented Feb 3, 2020

Oh, i'm stupid. I simply clicked "save as" on the .pth link. But if I open it on the browser I get:

<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>E8CF943BCC893DFE</RequestId><HostId>8L/NToTygqd2LiDk2yhuGpgWphBTLhE0BCEvpc+AgBbroAQSvCVSO9Gm9hcbNh3pXftyg1HmJ78=</HostId></Error>

Do I need to sign up to amazonaws.com or something? Is it free?

@rrmina
Copy link
Owner

rrmina commented Feb 3, 2020

Seems like Justin Johnson has already stopped hosting the vgg weights. I've uploaded it in my Google Drive. Here's the link: https://drive.google.com/file/d/1a0sFcNEvmIy21PE0yp7tzJuU0vhhV0Ln/view?usp=sharing

Let me know if it works or not.

@mrlogick
Copy link
Author

mrlogick commented Feb 3, 2020

Yes! It works, thanks man

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