facebookresearch / StyleNeRF

This is the open source implementation of the ICLR2022 paper "StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image Synthesis"
955 stars 91 forks source link

Setting up PyTorch plugin "bias_act_plugin"... Failed! #22

Open IceTea42 opened 2 years ago

IceTea42 commented 2 years ago

Hi, I am at the step "render the pretrained model" and I get an error related to "bias_act_plugin". I tried the suggestions below without success. Do you have any suggestions for this kind of error ?

the error message: python generate.py --outdir=/home/user/codes/public/StyleNeRF/out --trunc=0.7 --seeds=0 --network=/home/user/codes/public/StyleNeRF/pretrained/ffhq_512.pkl --render-program="rotation_camera" Loading networks from "/home/user/codes/public/StyleNeRF/pretrained/ffhq_512.pkl"... Generating image for seed 0 (0/1) ... Setting up PyTorch plugin "bias_act_plugin"... Failed! Traceback (most recent call last): File "/home/user/miniconda3/envs/stylenerf/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1539, in _run_ninja_build env=env) File "/home/user/miniconda3/envs/stylenerf/lib/python3.7/subprocess.py", line 512, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

my environment: OS: Ubuntu 18.04.6 LTS (bionic) gpu: Nvidia GeForce RTX 2060 (only one) conda env: conforms exactly to ./requirements.txt (python=3.7.12, torch=1.7.1, ...) cuda version: I have multiple cuda but the used one has the version 10.1.105 (cat /usr/local/cuda/version.txt) gcc version: 11.2.0, g++ version: 11.2.0

related suggestions that I found but didn't work for me: https://github.com/NVlabs/stylegan2-ada-pytorch/issues/39 (reinstall ninja) https://github.com/NVlabs/stylegan3/issues/124 (gcc, VS version)

techie02 commented 2 years ago

@IceTea42 I also encountered the same issue. I am getting this error when using CUDA=10.2. It seems the CUDA version might be contributing to the error. Where you able to fix this error ?

marianbasti commented 2 years ago

I get this error plenty of times when trying to run stylegan from different environments. It's got something to do with cpp and ninja compilers. Try going to the torch_extension folder, into where the plugin cache is and running ninja from there, you should get a more descriptive error.

El dom., 1 may. 2022 08:31, techie02 @.***> escribió:

@IceTea42 https://github.com/IceTea42 I also encountered the same issue. I am getting this error when using CUDA=10.2. It seems the CUDA version might be contributing to the error. Where you able to fix this error ?

— Reply to this email directly, view it on GitHub https://github.com/facebookresearch/StyleNeRF/issues/22#issuecomment-1114210338, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOA2YD6IHXCU64MHQGISI3VHZTSLANCNFSM5SPJVNMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

IceTea42 commented 2 years ago

@marianobasti Thanks for the suggestion.

@techie02 I haven't tried to re-debug this for a while. But recently for another reason I upgraded my OS version and wanted to retry. At the end, it was not at all due to OS change or anything like: The pytorch version used here is 1.7.1. From this page ( https://pytorch.org/get-started/previous-versions/ ) I found out that the most recent cuda version compatible with pytorch1.7.1 is cuda 11.0. For personal preferences I use conda environments oftentimes. In order to test this repo, by slightly modifying the requirements.txt to a env.yml file I already had a conda environment with which I am testing. I just installed cuda=11.0 on the same environment ( like this: conda install cudatoolkit=11.0 -c pytorch ) and it succeded. By installing it into an environment, I doesn't impact or use the cuda that you directly installed on your machine. No more errors, I could see the generated images and a .mp4 video. Hope this works for you as well.

zhywanna commented 2 years ago

running ninja from there

@marianobasti how to running ninja from there? I found a build.ninja there

marianbasti commented 2 years ago

Just write "ninja" and hit enter

El jue., 26 may. 2022 06:16, zhywanna @.***> escribió:

running ninja from there

@marianobasti https://github.com/marianobasti how to running ninja from there? I found a build.ninja there

— Reply to this email directly, view it on GitHub https://github.com/facebookresearch/StyleNeRF/issues/22#issuecomment-1138332265, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOA2YFDUFSOIIZFCZNSC3LVL46OFANCNFSM5SPJVNMA . You are receiving this because you were mentioned.Message ID: @.***>

techie02 commented 2 years ago

@IceTea42 @marianobasti I was also able to run the training successfully after upgrading the CUDA version to 11.0. I am training on compcars dataset. I was wondering why the car logo of the generated images does not resemble any of the real car logos e.g, the four rings in Audi is not reconstructed in any of the generated images. If anyone has tried generating car images please share your thoughts.

linzhi-li commented 2 years ago

I struggled for a whole day to get rid of the same error. Finally, I gave up in modifying my environmen, and strictly install the packages listed in the requirements.txt. After substituting the torch and torchvision with 1.11.0&0.12.0+cu115, reinstalling ninja and checking the latest VS++, the repo worked.