lightweight-gan icon indicating copy to clipboard operation
lightweight-gan copied to clipboard

Error(s) in loading state_dict for LightweightGAN

Open rickyars opened this issue 2 years ago • 2 comments

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"

rickyars avatar Apr 02 '22 23:04 rickyars

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.

iScriptLex avatar Apr 02 '22 23:04 iScriptLex

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

rickyars avatar Apr 02 '22 23:04 rickyars