Closed kirkegross closed 3 years ago
Hey there, it looks like the pickle file you're loading isn't returning a tuple of (generator, discriminator, g_ema). It's probably only the generator (as that's all you need for the colab).
Double clicking the file in the file browser on the left will open an editor. You can edit that line to remove , discriminator, g_ema
. Then you can try running the !python convert_weight.py ...
cell again.
Thank you, will try it out !
If I removed this I got this error now. Can I also change this line to something else: size = g_ema.output_shape[2]
Oh, my bad g_ema
is the one that gets used later on (that's the moving average of the generator which tends to have higher quality outputs). You should make sure the line is g_ema = pickle.load(f)
.
Thank you! I changed line 236 to this g_ema = pickle.load(f)
Now I got this: AttributeError: 'Sequential' object has no attribute '_inbound_nodes'
How have you created this .pkl file? What repository did you use to train your StyleGAN2 network?
This error seems to show that your .pkl file doesn't have some properties that the correct tensorflow network checkpoint should have.
Ok I see, thanks! That's what I thought. I trained my model following this tutorial https://github.com/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_07_2_Keras_gan.ipynb (Implementing DCGANs in Keras). In this tutorial the model was saved as .h5 and I converted it to .pkl.
But I understand now that I should have trained my model as StyleGAN2 network. Thanks for all the help! I will train my model as StyleGAN2 now and then I can use this repo.
Hi! I loaded in my own .pkl model and got this error after trying to convert tensorflow .pkl checkpoint to pytorch .pt checkpoint. Is there something wrong with my model?
Traceback (most recent call last): File "../stylegan2-pytorch/convert_weight.py", line 236, in
generator, discriminator, g_ema = pickle.load(f)
TypeError: 'Sequential' object is not iterable
Best, Kirke