harskish / ganspace

Discovering Interpretable GAN Controls [NeurIPS 2020]
Apache License 2.0
1.78k stars 264 forks source link

Stylegan2-ada and GANSpace #21

Open 100330706 opened 3 years ago

100330706 commented 3 years ago

Does this code works for stylegan2-ada?

harskish commented 3 years ago

Getting stylegan2-ada checkpoints to load probably requires some extra work. First of all, if the checkpoints are from TensorFlow, then they need to be converted to PyTorch. The conversion needs to be done with https://github.com/rosinality/stylegan2-pytorch, and if that repo doesn't support converting sg2-ada checkpoints, then that functionality needs to be added. Further, GANSpace uses a fork of the aforementioned repo, so any relevant changes need to be added to the fork (https://github.com/harskish/stylegan2-pytorch).

I'd be happy to accept a pull request if anyone gets this working!

100330706 commented 3 years ago

Hello! At the end I managed the code to work just by changing the repo path when converting the weights to pytorch weights:

python /content/ganspace/models/stylegan2/stylegan2-pytorch/convert_weight.py --repo="path/to/the/stylegan2-ada/repo" "tensorflow_pkl"

Once weights are converted GANSpace works fine. I just had to change a couple of paths to make it work within Colab.

Mohamed209 commented 3 years ago

got this issue while converting stylegan2ada model trained with continue training from ffhq256 on custom dataset KeyError: 'G_mapping/Dense2/weight' this is true as weights dict has no such layer

Mohamed209 commented 3 years ago

I solved the issue by converting with the original torch2stylegan repo not the fork included in your repo Thanks

Brainerd95 commented 2 years ago

got this issue while converting stylegan2ada model trained with continue training from ffhq256 on custom dataset KeyError: 'G_mapping/Dense2/weight' this is true as weights dict has no such layer

I get the exact same error (using the official stylegan2-ada repo as suggested above)

I solved the issue by converting with the original torch2stylegan repo not the fork included in your repo Thanks

Can you specify which exact repo you used for that?