Discovering Interpretable GAN Controls [NeurIPS 2020]

Overview

GANSpace: Discovering Interpretable GAN Controls

Python 3.7 PyTorch 1.3 Open In Colab teaser

Figure 1: Sequences of image edits performed using control discovered with our method, applied to three different GANs. The white insets specify the particular edits using notation explained in Section 3.4 ('Layer-wise Edits').

GANSpace: Discovering Interpretable GAN Controls
Erik Härkönen1,2, Aaron Hertzmann2, Jaakko Lehtinen1,3, Sylvain Paris2
1Aalto University, 2Adobe Research, 3NVIDIA
https://arxiv.org/abs/2004.02546

Abstract: This paper describes a simple technique to analyze Generative Adversarial Networks (GANs) and create interpretable controls for image synthesis, such as change of viewpoint, aging, lighting, and time of day. We identify important latent directions based on Principal Components Analysis (PCA) applied in activation space. Then, we show that interpretable edits can be defined based on layer-wise application of these edit directions. Moreover, we show that BigGAN can be controlled with layer-wise inputs in a StyleGAN-like manner. A user may identify a large number of interpretable controls with these mechanisms. We demonstrate results on GANs from various datasets.

Video: https://youtu.be/jdTICDa_eAI

Setup

See the setup instructions.

Usage

This repository includes versions of BigGAN, StyleGAN, and StyleGAN2 modified to support per-layer latent vectors.

Interactive model exploration

# Explore BigGAN-deep husky
python interactive.py --model=BigGAN-512 --class=husky --layer=generator.gen_z -n=1_000_000

# Explore StyleGAN2 ffhq in W space
python interactive.py --model=StyleGAN2 --class=ffhq --layer=style --use_w -n=1_000_000 -b=10_000

# Explore StyleGAN2 cars in Z space
python interactive.py --model=StyleGAN2 --class=car --layer=style -n=1_000_000 -b=10_000
# Apply previously saved edits interactively
python interactive.py --model=StyleGAN2 --class=ffhq --layer=style --use_w --inputs=out/directions

Visualize principal components

# Visualize StyleGAN2 ffhq W principal components
python visualize.py --model=StyleGAN2 --class=ffhq --use_w --layer=style -b=10_000

# Create videos of StyleGAN wikiart components (saved to ./out)
python visualize.py --model=StyleGAN --class=wikiart --use_w --layer=g_mapping -b=10_000 --batch --video

Options

Command line paramaters:
  --model      one of [ProGAN, BigGAN-512, BigGAN-256, BigGAN-128, StyleGAN, StyleGAN2]
  --class      class name; leave empty to list options
  --layer      layer at which to perform PCA; leave empty to list options
  --use_w      treat W as the main latent space (StyleGAN / StyleGAN2)
  --inputs     load previously exported edits from directory
  --sigma      number of stdevs to use in visualize.py
  -n           number of PCA samples
  -b           override automatic minibatch size detection
  -c           number of components to keep

Reproducibility

All figures presented in the main paper can be recreated using the included Jupyter notebooks:

  • Figure 1: figure_teaser.ipynb
  • Figure 2: figure_pca_illustration.ipynb
  • Figure 3: figure_pca_cleanup.ipynb
  • Figure 4: figure_style_content_sep.ipynb
  • Figure 5: figure_supervised_comp.ipynb
  • Figure 6: figure_biggan_style_resampling.ipynb
  • Figure 7: figure_edit_zoo.ipynb

Known issues

  • The interactive viewer sometimes freezes on startup on Ubuntu 18.04. The freeze is resolved by clicking on the terminal window and pressing the control key. Any insight into the issue would be greatly appreciated!

Integrating a new model

  1. Create a wrapper for the model in models/wrappers.py using the BaseModel interface.
  2. Add the model to get_model() in models/wrappers.py.

Importing StyleGAN checkpoints from TensorFlow

It is possible to import trained StyleGAN and StyleGAN2 weights from TensorFlow into GANSpace.

StyleGAN

  1. Install TensorFlow: conda install tensorflow-gpu=1.*.
  2. Modify methods __init__(), load_model() in models/wrappers.py under class StyleGAN.

StyleGAN2

  1. Follow the instructions in models/stylegan2/stylegan2-pytorch/README.md. Make sure to use the fork in this specific folder when converting the weights for compatibility reasons.
  2. Save the converted checkpoint as checkpoints/stylegan2/<dataset>_<resolution>.pt.
  3. Modify methods __init__(), download_checkpoint() in models/wrappers.py under class StyleGAN2.

Acknowledgements

We would like to thank:

  • The authors of the PyTorch implementations of BigGAN, StyleGAN, and StyleGAN2:
    Thomas Wolf, Piotr Bialecki, Thomas Viehmann, and Kim Seonghyeon.
  • Joel Simon from ArtBreeder for providing us with the landscape model for StyleGAN.
    (unfortunately we cannot distribute this model)
  • David Bau and colleagues for the excellent GAN Dissection project.
  • Justin Pinkney for the Awesome Pretrained StyleGAN collection.
  • Tuomas Kynkäänniemi for giving us a helping hand with the experiments.
  • The Aalto Science-IT project for providing computational resources for this project.

Citation

@inproceedings{härkönen2020ganspace,
  title     = {GANSpace: Discovering Interpretable GAN Controls},
  author    = {Erik Härkönen and Aaron Hertzmann and Jaakko Lehtinen and Sylvain Paris},
  booktitle = {Proc. NeurIPS},
  year      = {2020}
}

License

The code of this repository is released under the Apache 2.0 license.
The directory netdissect is a derivative of the GAN Dissection project, and is provided under the MIT license.
The directories models/biggan and models/stylegan2 are provided under the MIT license.

Comments
  • Setup Issues from: Step 5 + (Windows - Anaconda)

    Setup Issues from: Step 5 + (Windows - Anaconda)

    I'm trying to follow the Setup step by step for Windows 10 using Anaconda and Nvidia GPU.

    When I get to step 5: 5. Setup submodules: git submodule update --init --recursive

    I get this: fatal: not a git repository (or any of the parent directories): .git

    I skipped to step 6 and it installed the package with no issues, So I tried to ignore it for now and proceed with the because I was curious about the Windows step: Install included dependencies (downloaded from https://www.lfd.uci.edu/~gohlke/pythonlibs/): pip install deps/windows/*

    And I get this Error in red: ERROR: Invalid requirement: 'deps/windows/*'

    It says to download from the link, but... it's not clear, to download which file? There are hundreds of links so I'm a bit confused and hope that anyone can help trying to install it.

    Thanks ahead :)

    opened by AlonDan 22
  • Getting error when trying to run StyleGAN2 models

    Getting error when trying to run StyleGAN2 models

    Currently trying to play around with this as a little experiment, but whenever I try to run the StyleGAN2 interactive models, I get the following runtime error:

    RuntimeError: cuDNN error: CUDNN_STATUS_MAPPING_ERROR

    I believe I may not have correctly configured/set up the StyleGAN2 installation from the page, as when I run the command prompt for VS2017, I can't even use Anaconda correctly, but I can get through the other steps fine.

    I'm on a RTX 2070 and a Ryzen 5 3600.

    opened by erinbeesley 5
  • Forked repository mentioned in the README?

    Forked repository mentioned in the README?

    In the README, you mention a forked repository:

    Follow the instructions here. Make sure to use the forked repository in the conversion for compatibility reasons.

    ~However, there is no fork. Is it an obsolete sentence?~

    opened by woctezuma 4
  • "No module named 'model'" when trying to run interactive.py

    I have spent the last 5 hours trying to get this script to work assuming that it is something wrong on my end, but after reinstalling countless times I thought I would bring it up here to see if i could get some help. In SETUP.md for setting up stylegan2 it says to go to models/stylegan2/stylegan2-pytorch/op and run setup.py, however that directory does not exist, and so I was forced to skip that part of the setup, which I assume is causing this issue. The full error is as follows: Traceback (most recent call last): File "interactive.py", line 22, in <module> from models import get_instrumented_model File "/home/noah/ganspace-master/models/__init__.py", line 11, in <module> from .wrappers import * File "/home/noah/ganspace-master/models/wrappers.py", line 22, in <module> from . import stylegan2 File "/home/noah/ganspace-master/models/stylegan2/__init__.py", line 14, in <module> from model import Generator ModuleNotFoundError: No module named 'model'

    I am also unsure as to how I am meant to load up my own .pt file, as with the normal PyTorch version of stylegan2 you are able to specify the file when you run the generate command

    opened by MineThingIssues 3
  • missing 'model.py'

    missing 'model.py'

    I've followed the install instructions to the letter, but I'm unable to run interactive.py with any of the examples in the README (stylegan, stylegan2 or biggan)

    (NB the notes at the end about StyleGAN2 installation don't work - there is no setup.py in the directory)

    the error is:

    Traceback (most recent call last): File "interactive.py", line 22, in from models import get_instrumented_model File "/xxx/ganspace/models/init.py", line 11, in from .wrappers import * File "/xxx/ganspace/models/wrappers.py", line 22, in from . import stylegan2 File "/xxx/ganspace/models/stylegan2/init.py", line 14, in from model import Generator ModuleNotFoundError: No module named 'model'

    can you help?

    opened by squarevale 3
  • PyCUDA was compiled without GL extension support

    PyCUDA was compiled without GL extension support

    I have got PyCuda pip installed, I have cudnn, and cuda installed on my windows computer. But no matter what I do, I cannot get PyCUDA with GL extension support to work? I have tried https://stackoverflow.com/questions/8461505/pycuda-import-pycuda-gl-as-cuda-gl-how-to-find-pycuda-gl The solution listed there and it does not seem to work for me? Im sorry to ask about two issues, I'm very new to pycuda.

    opened by caleb-severn 2
  • Missing submodule?

    Missing submodule?

    Hey guys,

    I've been trying to play with this and I've been running into an error after installation when I'm trying to start the interactive.py. I did see the other listing with the same-ish issue, however there are no files in stylegan-pytorch to copy elsewhere, so I'm not sure what I'm missing. The error traceback is as follows:

    (ganspace) C:\Users\pixlo\Documents\ganspace-master>python interactive.py --model=BigGAN-512 --class=husky --layer=generator.gen_z -n=1_000_000 Traceback (most recent call last): File "interactive.py", line 22, in from models import get_instrumented_model File "C:\Users\pixlo\Documents\ganspace-master\models_init_.py", line 11, in from .wrappers import * File "C:\Users\pixlo\Documents\ganspace-master\models\wrappers.py", line 23, in from . import stylegan2 File "C:\Users\pixlo\Documents\ganspace-master\models\stylegan2_init_.py", line 14, in from model import Generator ModuleNotFoundError: No module named 'model'

    As far as I can tell this is because there is a missing model.py that is present in the stylegan folder but not the stylegan2 folder, however copying the one over to the other doesn't change anything. It may as well be that I'm missing something, python isn't my strong suit. Any suggestions?

    Thanks,

    -Morgan

    Edit: I deleted and re-extracted the folder from the master and I noticed that I'm now getting the error: (ganspace) C:\Users\pixlo\Documents\ganspace-master>git submodule update --init --recursive fatal: not a git repository (or any of the parent directories): .git

    I imagine this is the real issue, as it seems the subdirectories are tied to whatever I'm missing.

    opened by MorganRO8 2
  • Question about a new application

    Question about a new application

    Hi there,

    Thanks for sharing this amazing project. I am new in Deep Learning, but I want to learn everything I need to finish my project.

    I am trying to build a system to perform a specific task: add acne/wrinkles/scars/etc on faces. So, once I have a good dataset set of face images with acne (for example), can I accomplish this using your project?

    I saw your results with wrinkles, were awesome. Can you give the directions to perform the same thing with acne?

    opened by cpatrickalves 2
  • Cannot run Ganspace -- RuntimeError: CUDA error: invalid device function

    Cannot run Ganspace -- RuntimeError: CUDA error: invalid device function

    I am very interested in this software, however, I am having difficulty getting interactive.py to run properly.

    I am running Linux / Ubuntu 18.04 on an 8-core Intel Xeon E5462 tower with an NVIDIA GTX 1070 GPU, compute level 6.1. I installed all dependencies and built pycuda with opengl support; cuda 10.1 is available both on my system and in my anaconda environment.

    On executing "python interactive.py --model=StyleGAN2 --class=ffhq --layer=style --use_w -n=1000000 -b=10000" I get the following error:

    Traceback (most recent call last):
      File "interactive.py", line 644, in <module>
        setup_model()
      File "interactive.py", line 143, in setup_model
        inst = get_instrumented_model(model_name, class_name, layer_name, torch.device('cuda'), use_w=args.use_w)
      File "/mnt/drive2/pytorch/ganspace/models/wrappers.py", line 699, in get_instrumented_model
        latent_shape = model.get_latent_shape()
      File "/mnt/drive2/pytorch/ganspace/netdissect/modelconfig.py", line 107, in create_instrumented_model
        latent_shape=getattr(args, 'latent_shape', None))
      File "/mnt/drive2/pytorch/ganspace/netdissect/modelconfig.py", line 137, in annotate_model_shapes
        output = model(dry_run)
      File "/home/my-user/anaconda3/envs/ganspace/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
        result = self.forward(*input, **kwargs)
      File "/mnt/drive2/pytorch/ganspace/netdissect/nethook.py", line 48, in forward
        return self.model(*inputs, **kwargs)
      File "/home/my-user/anaconda3/envs/ganspace/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
        result = self.forward(*input, **kwargs)
      File "/mnt/drive2/pytorch/ganspace/models/wrappers.py", line 189, in forward
        truncation=self.truncation, truncation_latent=self.latent_avg, input_is_w=self.w_primary)
      File "/home/my-user/anaconda3/envs/ganspace/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
        result = self.forward(*input, **kwargs)
      File "/mnt/drive2/pytorch/ganspace/models/stylegan2/stylegan2-pytorch/model.py", line 495, in forward
        styles = [self.style(s) for s in styles]
      File "/mnt/drive2/pytorch/ganspace/models/stylegan2/stylegan2-pytorch/model.py", line 495, in <listcomp>
        styles = [self.style(s) for s in styles]
      File "/home/my-user/anaconda3/envs/ganspace/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
        result = self.forward(*input, **kwargs)
      File "/mnt/drive2/pytorch/ganspace/netdissect/nethook.py", line 181, in new_forward
        original_x = original_forward(*inputs, **kwargs)
      File "/home/my-user/anaconda3/envs/ganspace/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
        input = module(input)
      File "/home/my-user/anaconda3/envs/ganspace/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
        result = self.forward(*input, **kwargs)
      File "/mnt/drive2/pytorch/ganspace/models/stylegan2/stylegan2-pytorch/model.py", line 153, in forward
        out = F.linear(input, self.weight * self.scale)
    RuntimeError: CUDA error: invalid device function
    Segmentation fault (core dumped)
    

    Any help would be greatly appreciated.

    opened by 6630507 2
  • AttributeError: 'TorchImageView' object has no attribute '_OpenGLFrame__context'

    AttributeError: 'TorchImageView' object has no attribute '_OpenGLFrame__context'

    the error is:

    Loaded components for car from /home/jupyter/ganspace/cache/components/stylegan2-car_style_ipca_c80_n1000000.npz Seed: 1116518040 GLX version: 0.0 Screen is 0 Xlib: extension "GLX" missing on display ":20.0". Number of FBconfigs 0 oh dear - visual does not match Exception in Tkinter callback Traceback (most recent call last): File "/opt/conda/lib/python3.7/tkinter/init.py", line 1705, in call return self.func(*args) File "/opt/conda/lib/python3.7/site-packages/pyopengltk/base.py", line 29, in tkMap self.tkCreateContext() File "/opt/conda/lib/python3.7/site-packages/pyopengltk/linux.py", line 103, in tkCreateContext cfgs[best], ValueError: NULL pointer access Exception in Tkinter callback Traceback (most recent call last): File "/opt/conda/lib/python3.7/tkinter/init.py", line 1705, in call return self.func(*args) File "/opt/conda/lib/python3.7/site-packages/pyopengltk/base.py", line 74, in tkExpose self._display() File "/opt/conda/lib/python3.7/site-packages/pyopengltk/base.py", line 97, in _display self.tkMakeCurrent() File "/opt/conda/lib/python3.7/site-packages/pyopengltk/linux.py", line 156, in tkMakeCurrent GLX.glXMakeCurrent(self.__window, self._wid, self.__context) AttributeError: 'TorchImageView' object has no attribute '_OpenGLFrame__context' Traceback (most recent call last): File "interactive.py", line 651, in app.update() File "/home/jupyter/ganspace/TkTorchWindow.py", line 195, in update self.tkMakeCurrent() File "/opt/conda/lib/python3.7/site-packages/pyopengltk/linux.py", line 156, in tkMakeCurrent GLX.glXMakeCurrent(self.__window, self._wid, self.__context) AttributeError: 'TorchImageView' object has no attribute '_OpenGLFrame__context'

    Can you help?

    opened by cf904c27 2
  • fix_utils.py

    fix_utils.py

    I found an error when loading a pre-trained model from google drive. I will modify the relevant part, utils.py, and send a PR.

    I am using ganspace. Thank you so much.

    opened by n-yuzuto 1
  • How to convert .pkl to .pt?

    How to convert .pkl to .pt?

    I have some question, I have my .pkl file and I need to use in ganslace how to convert .pkl file to .pt file?

    I try to use convert_weight.py in stylegan2-pytorch but it’s not work , I think because convert_weight.py in stylegan2-pytorch support tensorflow 1.X but I can not install tensorflow 1.X

    I follow this step

    image0

    But “NVlabs/stylegan2” don’t have convert_weight.py , so I download “Stylegan-PyTorch“ instead and run code from picture but….

    image1

    The report is “No CUDA runtime is found”

    I don’t know what does it mean but I installed CUDA toolkits V10.0 and V11.0

    Please help me how to solve this issue and how to convert .plk to .pt for use with ganspac.

    I try to use pip uninstall torch and use pip install torch is not work.

    I try to install tensorflow 1.X version by I have used pip install tensorflow-gpu==1.5 but it’s not work.

    ‘please help me and teach me how to convert .pkl to .pt file.

    opened by TopKruZ 0
  • RuntimeError: cuda runtime error (1) : invalid argument at C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu:29

    RuntimeError: cuda runtime error (1) : invalid argument at C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu:29

    hello,McFredward,I encountered a problem, as shown in the following sentences: Two windows will appear and then flash back. How to solve this problem? D:\python\miniconda\envs\ganspace\python.exe E:/新电脑文件/论文/图纸生成/生成多角度二维图/gan-space/ganspace-master-ada/ganspace/interactive.py StyleGAN2: Optimized CUDA op FusedLeakyReLU not available, using native PyTorch fallback. StyleGAN2: Optimized CUDA op UpFirDn2d not available, using native PyTorch fallback. No layer 'g_mapping' in StyleGAN2-ada. Assuming you meant 'mapping' No layer 'g_mapping' in StyleGAN2-ada. Assuming you meant 'mapping' 1.8.0+cu111 Setting up PyTorch plugin "bias_act_plugin"... D:\python\miniconda\envs\ganspace\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte warnings.warn(f'Error checking compiler version for {compiler}: {error}') Done. Setting up PyTorch plugin "upfirdn2d_plugin"... D:\python\miniconda\envs\ganspace\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte warnings.warn(f'Error checking compiler version for {compiler}: {error}') Done. Loaded components for ffhq from E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\cache\components\stylegan2-ada-ffhq_mapping_ipca_c80_n300000.npz Seed: 1928965846 Using GPU 0 THCudaCheck FAIL file=C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu line=29 error=1 : invalid argument Traceback (most recent call last): File "E:/新电脑文件/论文/图纸生成/生成多角度二维图/gan-space/ganspace-master-ada/ganspace/interactive.py", line 655, in on_draw() File "E:/新电脑文件/论文/图纸生成/生成多角度二维图/gan-space/ganspace-master-ada/ganspace/interactive.py", line 475, in on_draw img = model.forward(z_final).clamp(0.0, 1.0) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\wrappers.py", line 203, in forward img = self.model.synthesis.forward(x, noise_mode='const',force_fp32= self.device.type == 'cpu') File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\training\networks.py", line 471, in forward x, img = block(x, img, cur_ws, **block_kwargs) File "D:\python\miniconda\envs\ganspace\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\training\networks.py", line 398, in forward x = self.conv1(x, next(w_iter), fused_modconv=fused_modconv, **layer_kwargs) File "D:\python\miniconda\envs\ganspace\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\training\networks.py", line 300, in forward padding=self.padding, resample_filter=self.resample_filter, flip_weight=flip_weight, fused_modconv=fused_modconv) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\misc.py", line 101, in decorator return fn(*args, **kwargs) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\training\networks.py", line 80, in modulated_conv2d x = conv2d_resample.conv2d_resample(x=x, w=w.to(x.dtype), f=resample_filter, up=up, down=down, padding=padding, groups=batch_size, flip_weight=flip_weight) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\misc.py", line 101, in decorator return fn(*args, **kwargs) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\ops\conv2d_resample.py", line 147, in conv2d_resample return _conv2d_wrapper(x=x, w=w, padding=[py0,px0], groups=groups, flip_weight=flip_weight) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\ops\conv2d_resample.py", line 54, in _conv2d_wrapper return op(x, w, stride=stride, padding=padding, groups=groups) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\ops\conv2d_gradfix.py", line 38, in conv2d return torch.nn.functional.conv2d(input=input, weight=weight, bias=bias, stride=stride, padding=padding, dilation=dilation, groups=groups) RuntimeError: cuda runtime error (1) : invalid argument at C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu:29

    Process finished with exit code 1

    opened by ChengXuanhao 1
  • RuntimeError: cuda runtime error (1) : invalid argument at C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu:29

    RuntimeError: cuda runtime error (1) : invalid argument at C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu:29

    hello,McFredward,I encountered a problem, as shown in the following sentences: Two windows will appear and then flash back. How to solve this problem? D:\python\miniconda\envs\ganspace\python.exe E:/新电脑文件/论文/图纸生成/生成多角度二维图/gan-space/ganspace-master-ada/ganspace/interactive.py StyleGAN2: Optimized CUDA op FusedLeakyReLU not available, using native PyTorch fallback. StyleGAN2: Optimized CUDA op UpFirDn2d not available, using native PyTorch fallback. No layer 'g_mapping' in StyleGAN2-ada. Assuming you meant 'mapping' No layer 'g_mapping' in StyleGAN2-ada. Assuming you meant 'mapping' 1.8.0+cu111 Setting up PyTorch plugin "bias_act_plugin"... D:\python\miniconda\envs\ganspace\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte warnings.warn(f'Error checking compiler version for {compiler}: {error}') Done. Setting up PyTorch plugin "upfirdn2d_plugin"... D:\python\miniconda\envs\ganspace\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte warnings.warn(f'Error checking compiler version for {compiler}: {error}') Done. Loaded components for ffhq from E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\cache\components\stylegan2-ada-ffhq_mapping_ipca_c80_n300000.npz Seed: 1928965846 Using GPU 0 THCudaCheck FAIL file=C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu line=29 error=1 : invalid argument Traceback (most recent call last): File "E:/新电脑文件/论文/图纸生成/生成多角度二维图/gan-space/ganspace-master-ada/ganspace/interactive.py", line 655, in on_draw() File "E:/新电脑文件/论文/图纸生成/生成多角度二维图/gan-space/ganspace-master-ada/ganspace/interactive.py", line 475, in on_draw img = model.forward(z_final).clamp(0.0, 1.0) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\wrappers.py", line 203, in forward img = self.model.synthesis.forward(x, noise_mode='const',force_fp32= self.device.type == 'cpu') File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\training\networks.py", line 471, in forward x, img = block(x, img, cur_ws, **block_kwargs) File "D:\python\miniconda\envs\ganspace\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\training\networks.py", line 398, in forward x = self.conv1(x, next(w_iter), fused_modconv=fused_modconv, **layer_kwargs) File "D:\python\miniconda\envs\ganspace\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\training\networks.py", line 300, in forward padding=self.padding, resample_filter=self.resample_filter, flip_weight=flip_weight, fused_modconv=fused_modconv) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\misc.py", line 101, in decorator return fn(*args, **kwargs) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\training\networks.py", line 80, in modulated_conv2d x = conv2d_resample.conv2d_resample(x=x, w=w.to(x.dtype), f=resample_filter, up=up, down=down, padding=padding, groups=batch_size, flip_weight=flip_weight) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\misc.py", line 101, in decorator return fn(*args, **kwargs) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\ops\conv2d_resample.py", line 147, in conv2d_resample return _conv2d_wrapper(x=x, w=w, padding=[py0,px0], groups=groups, flip_weight=flip_weight) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\ops\conv2d_resample.py", line 54, in _conv2d_wrapper return op(x, w, stride=stride, padding=padding, groups=groups) File "E:\新电脑文件\论文\图纸生成\生成多角度二维图\gan-space\ganspace-master-ada\ganspace\models\stylegan2_ada\stylegan2-ada-pytorch\torch_utils\ops\conv2d_gradfix.py", line 38, in conv2d return torch.nn.functional.conv2d(input=input, weight=weight, bias=bias, stride=stride, padding=padding, dilation=dilation, groups=groups) RuntimeError: cuda runtime error (1) : invalid argument at C:/w/b/windows/pytorch/aten/src\THC/generic/THCTensorMath.cu:29

    Process finished with exit code 1

    opened by ChengXuanhao 0
  • [Question] What is X_comp and Z_comp?

    [Question] What is X_comp and Z_comp?

    I could not understand what is X_comp with dimensions, (number of components to keep, 1, feature space dimensions) and Z_comp with dimensions, (number of components to keep, 1, latent space dims)

    opened by PratikStar 0
Owner
Erik Härkönen
PhD student at Aalto University
Erik Härkönen
DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time

DR-GAN: Automatic Radial Distortion Rectification Using Conditional GAN in Real-Time Introduction This is official implementation for DR-GAN (IEEE TCS

Kang Liao 18 Dec 23, 2022
discovering subdomains, hidden paths, extracting unique links

python-website-crawler discovering subdomains, hidden paths, extracting unique links pip install -r requirements.txt discover subdomain: You can give

merve 4 Sep 5, 2022
Ian Covert 130 Jan 1, 2023
Supplementary code for SIGGRAPH 2021 paper: Discovering Diverse Athletic Jumping Strategies

SIGGRAPH 2021: Discovering Diverse Athletic Jumping Strategies project page paper demo video Prerequisites Important Notes We suspect there are bugs i

null 54 Dec 6, 2022
The self-supervised goal reaching benchmark introduced in Discovering and Achieving Goals via World Models

Lexa-Benchmark Codebase for the self-supervised goal reaching benchmark introduced in 'Discovering and Achieving Goals via World Models'. Setup Create

null 1 Oct 14, 2021
DIR-GNN - Discovering Invariant Rationales for Graph Neural Networks

DIR-GNN "Discovering Invariant Rationales for Graph Neural Networks" (ICLR 2022)

Ying-Xin (Shirley) Wu 70 Nov 13, 2022
StyleSpace Analysis: Disentangled Controls for StyleGAN Image Generation

StyleSpace Analysis: Disentangled Controls for StyleGAN Image Generation Demo video: CVPR 2021 Oral: Single Channel Manipulation: Localized or attribu

Zongze Wu 267 Dec 30, 2022
Implementation of StyleSpace Analysis: Disentangled Controls for StyleGAN Image Generation in PyTorch

StyleSpace Analysis: Disentangled Controls for StyleGAN Image Generation Implementation of StyleSpace Analysis: Disentangled Controls for StyleGAN Ima

Xuanchi Ren 86 Dec 7, 2022
Language Models Can See: Plugging Visual Controls in Text Generation

Language Models Can See: Plugging Visual Controls in Text Generation Authors: Yixuan Su, Tian Lan, Yahui Liu, Fangyu Liu, Dani Yogatama, Yan Wang, Lin

Yixuan Su 195 Dec 22, 2022
This is a pytorch implementation of the NeurIPS paper GAN Memory with No Forgetting.

GAN Memory for Lifelong learning This is a pytorch implementation of the NeurIPS paper GAN Memory with No Forgetting. Please consider citing our paper

Miaoyun Zhao 43 Dec 27, 2022
[NeurIPS 2021] Deceive D: Adaptive Pseudo Augmentation for GAN Training with Limited Data

Deceive D: Adaptive Pseudo Augmentation for GAN Training with Limited Data (NeurIPS 2021) This repository provides the official PyTorch implementation

Liming Jiang 155 Nov 30, 2021
Code for CVPR2021 paper 'Where and What? Examining Interpretable Disentangled Representations'.

PS-SC GAN This repository contains the main code for training a PS-SC GAN (a GAN implemented with the Perceptual Simplicity and Spatial Constriction c

Xinqi/Steven Zhu 40 Dec 16, 2022
Annotated, understandable, and visually interpretable PyTorch implementations of: VAE, BIRVAE, NSGAN, MMGAN, WGAN, WGANGP, LSGAN, DRAGAN, BEGAN, RaGAN, InfoGAN, fGAN, FisherGAN

Overview PyTorch 0.4.1 | Python 3.6.5 Annotated implementations with comparative introductions for minimax, non-saturating, wasserstein, wasserstein g

Shayne O'Brien 471 Dec 16, 2022
Data and Code for ACL 2021 Paper "Inter-GPS: Interpretable Geometry Problem Solving with Formal Language and Symbolic Reasoning"

Introduction Code and data for ACL 2021 Paper "Inter-GPS: Interpretable Geometry Problem Solving with Formal Language and Symbolic Reasoning". We cons

Pan Lu 81 Dec 27, 2022
Towards Interpretable Deep Metric Learning with Structural Matching

DIML Created by Wenliang Zhao*, Yongming Rao*, Ziyi Wang, Jiwen Lu, Jie Zhou This repository contains PyTorch implementation for paper Towards Interpr

Wenliang Zhao 75 Nov 11, 2022
The official code for paper "R2D2: Recursive Transformer based on Differentiable Tree for Interpretable Hierarchical Language Modeling".

R2D2 This is the official code for paper titled "R2D2: Recursive Transformer based on Differentiable Tree for Interpretable Hierarchical Language Mode

Alipay 49 Dec 17, 2022
PyTorch implementation of Interpretable Explanations of Black Boxes by Meaningful Perturbation

PyTorch implementation of Interpretable Explanations of Black Boxes by Meaningful Perturbation The paper: https://arxiv.org/abs/1704.03296 What makes

Jacob Gildenblat 322 Dec 17, 2022
The official implementation of CSG-Stump: A Learning Friendly CSG-Like Representation for Interpretable Shape Parsing

CSGStumpNet The official implementation of CSG-Stump: A Learning Friendly CSG-Like Representation for Interpretable Shape Parsing Paper | Project page

Daxuan 39 Dec 26, 2022
CAPRI: Context-Aware Interpretable Point-of-Interest Recommendation Framework

CAPRI: Context-Aware Interpretable Point-of-Interest Recommendation Framework This repository contains a framework for Recommender Systems (RecSys), a

RecSys Lab 8 Jul 3, 2022