JCBrouwer / maua-stylegan2

This is the repo for my experiments with StyleGAN2. There are many like it, but this one is mine. Contains code for the paper Audio-reactive Latent Interpolations with StyleGAN.
https://wavefunk.xyz/audio-reactive-stylegan
179 stars 29 forks source link

RuntimeError on get_bends=get_bends, #9

Closed apollo01gaming closed 3 years ago

apollo01gaming commented 3 years ago

Hello, thank you for creating this repo.

I'm pulling my hair over this error. please help.

Thank you very much


RuntimeError Traceback (most recent call last)

in () 15 get_latents=get_latents, 16 get_noise=get_noise, ---> 17 get_bends=get_bends, 18 ) 3 frames /usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict) 1050 if len(error_msgs) > 0: 1051 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( -> 1052 self.__class__.__name__, "\n\t".join(error_msgs))) 1053 return _IncompatibleKeys(missing_keys, unexpected_keys) 1054 RuntimeError: Error(s) in loading state_dict for Generator: Missing key(s) in state_dict: "convs.14.conv.weight", "convs.14.conv.blur.kernel", "convs.14.conv.modulation.weight", "convs.14.conv.modulation.bias", "convs.14.noise.weight", "convs.14.activate.bias", "convs.15.conv.weight", "convs.15.conv.modulation.weight", "convs.15.conv.modulation.bias", "convs.15.noise.weight", "convs.15.activate.bias", "to_rgbs.7.bias", "to_rgbs.7.upsample.kernel", "to_rgbs.7.conv.weight", "to_rgbs.7.conv.modulation.weight", "to_rgbs.7.conv.modulation.bias", "noises.noise_15", "noises.noise_16".
JCBrouwer commented 3 years ago

The traceback is a bit misleading here, it's not breaking on get_bends, but on the generate() function (which get_bends is an argument to). Looking a bit further down, the real error is happening in load_state_dict() because the checkpoint you're trying to restore from doesn't have certain keys.

Are you trying to load a 512px network?

In that case you'll need to add G_res=512 to generate() if you're running from colab or specify --G_res 512 in command line.

One thing to note is that the default get_bends() function in the colab notebook only works for 1024px networks, so if you add G_res=512 you'll need to comment out get_bends=get_bends.

apollo01gaming commented 3 years ago

Hello, thank you for your reply. You are absolutely right. I was using 512px pkl. ill try it with my 1024 network.

I believe this closes this issue. Thank you.