Fail to load parameters with Spectral norm?

I tried to train a generator and save the state_dict. But got error KeyError: 'conv1_1.weight' when load the saved state_dict.

When I printed out keys of saved state_dict, only find conv1_1.weight_orig, conv1_1.weight_u and conv1_1.weight_v.

How can I solve this issue? Or how can I save the trained model to make it loadable? Thanks

In case you are still suffering from this issue, check that the ‘_metadata’ attribute is not being removed from the state_dict that you load.

1 Like

How did you implement your SN layer, with torch.nn.utils.spectralnom or something like spectralnorm?

Yes, see SPADE for an example

Great ! Fixed this issue by keeping “_metadata” attribute not deleted.