Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ganspace not compatible with StyleGan2-ADA-PyTorch models #37

Open
pbizimis opened this issue Mar 14, 2021 · 7 comments
Open

Ganspace not compatible with StyleGan2-ADA-PyTorch models #37

pbizimis opened this issue Mar 14, 2021 · 7 comments

Comments

@pbizimis
Copy link

Hey,
I tried setting up Ganspace with StyleGan2-ADA-PyTorch models but it seems not possible without modifying code.
Most errors show that the module torch_utils is necessary to load the model pkl files.

    magic_number = pickle_module.load(f, **pickle_load_args)
ModuleNotFoundError: No module named 'torch_utils'

I also was not able to convert weights.
Any ideas on how to make ganspace working with the new model files? Thanks

@harskish
Copy link
Owner

Since StyleGan2-ADA-PyTorch is a pytorch codebase, it would probably be easiest to add it alongside the other models (in models/wrappers.py) as an alternative StyleGAN2 implementation. It might also be possible to convert StyleGan2-ADA-PyTorch pickles to the format expected by using rosinality's repo (https://github.com/rosinality/stylegan2-pytorch), but that seems more error-prone.

@mctrinkle
Copy link

I agree StyleGan2-ADA-PyTorch implementation should be added to wrappers.py and I have tried this and haven't had time to finish it. However, I believe rosinality's repo (https://github.com/rosinality/stylegan2-pytorch) is meant to convert from tf weights and will not work.

@pbizimis
Copy link
Author

While I was looking for a solution, I found the closed-form factorization implementation in rosinality's repo (https://github.com/rosinality/stylegan2-pytorch). I managed to get it working with the new StyleGan2-ADA-PyTorch models. You can find it here https://github.com/pbizimis/stylegan2-ada-pytorch.
Closed-form factorization can be an alternative for Ganspace (https://arxiv.org/pdf/2007.06600.pdf).

@tocantrell
Copy link

For anyone that stumbles on this thread like I did in trying to find a solution for latent space manipulation with StyleGan2-ADA: while it is great work that led me to my current solution, pbizimis's code does not alter the w-space as I expected it to. But after creating my own working solution based on it, I saw that someone already published the same code improved to use w-space:
https://github.com/dvschultz/stylegan2-ada-pytorch
I would just caution that lines 38-40 of apply_factor.py may have better performance on GPU without the 'force_fp32=True'.

@clairesquires99
Copy link

I agree StyleGan2-ADA-PyTorch implementation should be added to wrappers.py and I have tried this and haven't had time to finish it. However, I believe rosinality's repo (https://github.com/rosinality/stylegan2-pytorch) is meant to convert from tf weights and will not work.

Since this was a while ago, I though it would be worth checking wether the StyleGan2-ADA-PyTorch implementation had still not been added to wrappers.py?

@McFredward
Copy link

I've implemented StyleGAN2-ada support (along with other changes) in my fork:

https://github.com/McFredward/ganspace

@f3ax
Copy link

f3ax commented Apr 13, 2023

I've implemented StyleGAN2-ada support (along with other changes) in my fork:

https://github.com/McFredward/ganspace

@McFredward Hello, I know it's been a long time since you posted this fork, but I am trying to use it and I am having a few issues if you could please provide any explanation or guidance that would be super helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants