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

Trouble Getting Pre-Trained Models to Work #15

Closed
EoinKenny opened this issue Jan 1, 2020 · 1 comment
Closed

Trouble Getting Pre-Trained Models to Work #15

EoinKenny opened this issue Jan 1, 2020 · 1 comment

Comments

@EoinKenny
Copy link

Hi, thanks for supplying this repo.

I've been trying to use your .py files and saved weights to load your pre-trained model. But there's a few problems.

If I understand corretly, I am supposed to download/use these weights 'exps/autogan_cifar10_a.sh', and use the associated .py file.

I used the following info
python test.py
--dataset cifar10
--img_size 32
--bottom_width 4
--gen_model autogan_cifar10_a
--latent_dim 128
--gf_dim 256
--g_spectral_norm False
--load_path /path/to/*.pth
--exp_name test_autogan_cifar10_a

...and put it manually into the autogan_cifar10_a.py file. But I get the following error when I try load the weights into the class.

`---> 52 G.load_state_dict(torch.load('weights/autogan_cifar10_a.pth', map_location='cpu'))
53 cnn.load_state_dict(torch.load('weights/cifar-10_cnn Resnet.pth', map_location='cpu'))
54

/anaconda3/envs/exp1/lib/python3.6/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
775 if len(error_msgs) > 0:
776 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
--> 777 self.class.name, "\n\t".join(error_msgs)))
778 return _IncompatibleKeys(missing_keys, unexpected_keys)
779

RuntimeError: Error(s) in loading state_dict for Generator:
Missing key(s) in state_dict: "cell1.n1.weight", "cell1.n1.bias", "cell1.n1.running_mean", "cell1.n1.running_var", "cell1.n2.weight", "cell1.n2.bias", "cell1.n2.running_mean", "cell1.n2.running_var".
`

Thank you in advance for any help, perhaps you could provide a working example where you load the pre-trained model and generate some samples in a jupyter notebook? Happy new year :-)

@GongXinyuu
Copy link
Collaborator

Hi, would you mind show more code to me? Thus I can help to debug.

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