Comments (8)
Hi Samuel,
The fork of stylegan2 that's used by the project (https://github.com/harskish/stylegan2-pytorch) is slightly older than Rosinality's official version (https://github.com/rosinality/stylegan2-pytorch) and doesn't handle the noise inputs that you're seeing in the error. You could either update the stylegan2 fork to match Rosinality, or re-convert the checkpoint using the fork instead of the official repo.
I haven't tried to use other than the f-configs of StyleGAN2, so if you get it working please let me know. I'd be happy to accept a pull request on any necessary code changes.
from ganspace.
Thank you Erik for the response, I'll try both solutions and I'll let you know what comes out.
from ganspace.
@woctezuma a few comments:
- g_mapping is just the default value for the layer parameter. I guess making the default None would be more in line with the documentation
- The first error isn't really an error - it just tells you that you need to specify a correct layer to analyze, since the default (g_mapping) is invalid for StyleGAN2.
- The notebook you linked isn't the official one (accessed via the readme), although I think the official notebook is basically identical.
- Justin Pinkney's fork (https://github.com/justinpinkney/ganspace/) has a few config-e related changes, if you run into more issues you can look there for inspiration!
from ganspace.
g_mapping is not a dummy value per se, but rather a default layer name that exists in StyleGAN1 (but not StyleGAN2).
As for the Colab notebook, I was referring to https://colab.research.google.com/github/harskish/ganspace/blob/master/notebooks/Ganspace_colab.ipynb (which is pretty much identical to the one you've been using)
from ganspace.
The readme should make the mismatch explicit. I'll look into updating the readme (and potentially the SG2 fork).
from ganspace.
I follow this notebook: https://colab.research.google.com/drive/1g-ShMzkRWDMHPyjom_p-5kqkn2f-GwBi
I try to use a PyTorch 256x256 config-e
model, which I have converted with the flag --channel_multiplier=1
and put here:
/content/ganspace/models/checkpoints/stylegan2/stylegan2_steam_256.pt
I have implemented the fixes mentioned above in my fork.
I then define a few variables before I try to run the important parts of the notebook:
model_name = 'StyleGAN2'
model_class = 'steam'
num_components = 80
Then I run this:
!python visualize.py --model $model_name --class $model_class --use_w
and encounter this error:
[21.09 15:16] StyleGAN2, g_mapping, ipca
Layer 'g_mapping' not found in model!
Available layers:
style
style.0
style.1
style.2
[...]
strided_style.11
strided_style.12
strided_style.13
Traceback (most recent call last):
File "visualize.py", line 152, in <module>
inst = get_instrumented_model(args.model, args.output_class, layer_key, device, use_w=args.use_w)
File "/usr/lib/python3.6/functools.py", line 807, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/content/ganspace/models/wrappers.py", line 715, in get_instrumented_model
raise RuntimeError(f"Unknown layer '{layer_name}''")
RuntimeError: Unknown layer 'g_mapping''
However, this works:
!python visualize.py --model $model_name --class $model_class --use_w --layer=style -c $num_components
Any idea how to fix the error? Although it seems I can use the rest of the code just fine, I would like to remove every error.
I think that is because:
- there is an issue with layer
g_mapping
, - the first command omits the
--layer
flag, which makes the program try to list all the layers, including the faulty one:
--layer layer at which to perform PCA; leave empty to list options
from ganspace.
Thank you for your reply.
It was really not obvious to me that the default value (g_mapping
) was a dummy name, especially as it appears also here:
Lines 224 to 228 in 2480494
I have been using this unofficial notebook, because I encounter an OpenGL issue with interactive.py
on Google Colab, and this unofficial notebook only makes use of visualize.py
, plus some code in a notebook cell to work around interactive.py
.
So far so good, I get results with your method which are similar (but more manageable) than with "closed-form factorization".
I will look at Justin Pinkney's fork, just in case.
from ganspace.
Right. Thanks. I did not realize it was the same!
from ganspace.
Related Issues (20)
- Issues installing on Ubuntu 20.04 (Solved) HOT 1
- Save direction error
- Pycuda install error: command 'gcc' failed with exit status 1 HOT 1
- Not working with conditional StyleGAN2-ADA model HOT 3
- Why your PCA components have 512 dimensions rather than 18*512 in Stylegan2 ? HOT 1
- CUDA 10.1 is not compatible with newer GPUs HOT 1
- Error to load model after .pkl. to .pt conversion of StyleGAN2 model - zip archive HOT 1
- googledrive not downloading ,m pleas sepcify instructions where model files should be for manual download HOT 1
- Does biggan stylegan1, stylegan2 and stylegan-ada space lookups supported?
- StyleGAN3 implementation
- [Question] What is X_comp and Z_comp?
- when running interactive.py occur the following error HOT 1
- RuntimeError: cuda runtime error (1) : invalid argument at C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu:29 HOT 1
- OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. HOT 1
- RuntimeError: cuDNN error: CUDNN_STATUS_MAPPING_ERROR
- How to convert .pkl to .pt?
- Tensorflow 1 is unsupported in Colab.
- In which linear layer did you apply PCA?
- Having two "colon" marks in "environment.yml" file raises error. HOT 1
- How to explore 18x512 dimensional style vectors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ganspace.