mchong6 / JoJoGAN

Official PyTorch repo for JoJoGAN: One Shot Face Stylization
MIT License
1.42k stars 206 forks source link

Using another pretrained StyleGAN2 #35

Closed JbIPS closed 2 years ago

JbIPS commented 2 years ago

Hi,

I'm playing with your notebook (awesome work btw!) and I try to give it another pretrained GAN from Awesome Pretrained StyleGAN2.

I used the anime one (PyTorch implementation from here) but I get

TypeError                                 Traceback (most recent call last)

[<ipython-input-10-2395bdddca96>](https://localhost:8080/#) in <module>()
     22 
     23 #print(ckpt)
---> 24 generator.load_state_dict(ckpt["g"], strict=False)
     25 
     26 #@title Generate results

TypeError: 'Generator' object is not subscriptable

Do I need further operation on the model to make it compatible?

Thank you

mchong6 commented 2 years ago

Maybe the pretrained model is trained using the official stylegan2 repo. The repo I built upon is by rosalinity. To make it compatible you have to convert the model file to one that is compatible with this repo. Look at the readme of the rosalinity repo to see how to do that.

JbIPS commented 2 years ago

My bad, it looks like my file only contains the structure of the network, not the saved weights