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

Error(s) in loading state_dict for LightweightGAN #116

Open
rickyars opened this issue Apr 2, 2022 · 2 comments
Open

Error(s) in loading state_dict for LightweightGAN #116

rickyars opened this issue Apr 2, 2022 · 2 comments

Comments

@rickyars
Copy link

rickyars commented Apr 2, 2022

When using --antialias I get the following error when trying to call --show-progress:

Traceback (most recent call last):
File "/usr/local/bin/lightweight_gan", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/lightweight_gan/cli.py", line 190, in main
fire.Fire(train_from_folder)
File "/usr/local/lib/python3.7/dist-packages/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/usr/local/lib/python3.7/dist-packages/fire/core.py", line 471, in _Fire
target=component.name)
File "/usr/local/lib/python3.7/dist-packages/fire/core.py", line 681, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/lightweight_gan/cli.py", line 171, in train_from_folder
model.show_progress(num_images=num_image_tiles, types=generate_types)
File "/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/lightweight_gan/lightweight_gan.py", line 1306, in show_progress
self.load(checkpoint, print_version=False)
File "/usr/local/lib/python3.7/dist-packages/lightweight_gan/lightweight_gan.py", line 1471, in load
raise e
File "/usr/local/lib/python3.7/dist-packages/lightweight_gan/lightweight_gan.py", line 1468, in load
self.GAN.load_state_dict(load_data['GAN'])
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 1483, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for LightweightGAN:
Unexpected key(s) in state_dict: "G.layers.0.0.1.f", "G.layers.1.0.1.f", "G.layers.2.0.1.f", "G.layers.3.0.1.f", "G.layers.4.0.1.f", "G.layers.5.0.1.f", "G.layers.6.0.1.f", "D.non_residual_layers.0.0.f", "D.residual_layers.0.0.branches.0.0.f", "D.residual_layers.0.0.branches.1.0.f", "D.residual_layers.1.0.branches.0.0.f", "D.residual_layers.1.0.branches.1.0.f", "D.residual_layers.2.0.branches.0.0.f", "D.residual_layers.2.0.branches.1.0.f", "D.residual_layers.3.0.branches.0.0.f", "D.residual_layers.3.0.branches.1.0.f", "D.residual_layers.4.0.branches.0.0.f", "D.residual_layers.4.0.branches.1.0.f", "D.to_logits.0.f", "D.to_shape_disc_out.2.branches.0.0.f", "D.to_shape_disc_out.2.branches.1.0.f", "GE.layers.0.0.1.f", "GE.layers.1.0.1.f", "GE.layers.2.0.1.f", "GE.layers.3.0.1.f", "GE.layers.4.0.1.f", "GE.layers.5.0.1.f", "GE.layers.6.0.1.f", "D_aug.D.non_residual_layers.0.0.f", "D_aug.D.residual_layers.0.0.branches.0.0.f", "D_aug.D.residual_layers.0.0.branches.1.0.f", "D_aug.D.residual_layers.1.0.branches.0.0.f", "D_aug.D.residual_layers.1.0.branches.1.0.f", "D_aug.D.residual_layers.2.0.branches.0.0.f", "D_aug.D.residual_layers.2.0.branches.1.0.f", "D_aug.D.residual_layers.3.0.branches.0.0.f", "D_aug.D.residual_layers.3.0.branches.1.0.f", "D_aug.D.residual_layers.4.0.branches.0.0.f", "D_aug.D.residual_layers.4.0.branches.1.0.f", "D_aug.D.to_logits.0.f", "D_aug.D.to_shape_disc_out.2.branches.0.0.f", "D_aug.D.to_shape_disc_out.2.branches.1.0.f"

@iScriptLex
Copy link

You can't change antialiasing type when network is already exists and has checkpoints. You should start entirely new instance of network for switching this feature, because it inflicts the network structure.

@rickyars
Copy link
Author

rickyars commented Apr 2, 2022

Wow - I'm such an idiot. Thank you.

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