anvoynov / GANLatentDiscovery

The authors official implementation of Unsupervised Discovery of Interpretable Directions in the GAN Latent Space
416 stars 52 forks source link

StyleGAN2 load fail: No module named 'fused #23

Closed rengotj closed 3 years ago

rengotj commented 3 years ago

Dear everyone, Thank you very much for this repository.

I am not able to run your code for StylgeGan2 models. The issue is that fused cannot be loaded. I am using :

Thank you very much.

anvoynov commented 3 years ago

Hi @rengotj apparently, Windows is the issue as the fused is the cuda-compilable module from this repo: https://github.com/rosinality/stylegan2-pytorch take a look at this issue, hope it would be helpful: https://github.com/rosinality/stylegan2-pytorch/issues/63

chi0tzp commented 3 years ago

@anvoynov I just figured it out (not for Windows, but it could give some insights). So, you need to work with some recent CUDA version to begin with. I'm on CUDA 10.2, for instance Then, depending on your python environment (I use venv) you need to copy the following files into your environment, as follows:

cp /usr/local/cuda-10.2/targets/x86_64-linux/include/cublas_api.h venv/lib/python3.8/site-packages/torch/include/
cp /usr/local/cuda-10.2/targets/x86_64-linux/include/cublas_v2.h venv/lib/python3.8/site-packages/torch/include/

Obviously the paths could be a bit different for you. Hope that help. cc @rengotj

anvoynov commented 3 years ago

That's strange as I have not copied any files from cuda. I have CUDA 10.2, drivers version 440.33.01, pytorch 1.6, ninja 1.10, all in conda env.

chi0tzp commented 3 years ago

@anvoynov It doesn't happen always, or under any environment. For instance, in my Arch, I had no problems. I faced it when I had to run something on a CentOS server.

rengotj commented 3 years ago

Thank you!