stylegan Ubuntu env setup

发布时间:2024-03-02  栏目:AI应用领域, GPU, VideoConference, 人工智能, 元宇宙, 图像处理, 机器视觉  评论:0 Comments

Check the python, pytorch and Ubuntu version in conda env:

  • python –version
  • conda list pytorch
  • lsb_release -a
  • gcc –version
  • 看CUDA版本的方法有多种,通过命令行查看。打开命令提示符(CMD),输入`nvcc -V`或`nvcc –version`


Physical machine:

  • RTX 2080


  • Ubuntu 22.04.4 LTS
  • pytorch                   1.9.1           py3.9_cuda11.1_cudnn8.0.5_0    pytorch
  • Python 3.9.18
  • Cuda compilation tools, release 11.5, V11.5.119
    Build cuda_11.5.r11.5/compiler.30672275_0
  • gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0






What is StyleGAN2

StyleGAN2 is a State-Of-The-Art (SOTA) generative adversarial network (GAN).


When training StyleGAN2, you may most likely will encounter following issue:

Setting up PyTorch plugin "bias_act_plugin"... Failed.
Setting up PyTorch plugin "upfirdn2d_plugin"... Failed.

The reason you see this message is that StyleGAN2 used ninja to build its cuda file. Theoretically, you can solve this by running shell command sudo apt-get install ninja. However, in case you don’t have root permission, you can git clone ninja repo into your project running path, and you can use command ninja -v to check if the ninja is ready. If you have done it right, you should not see something like error: loading '': No such file or directory.

If you have already solved your problem, good. But here is another situation you may encounter. If you are using cuda driver higher than cuda 11.6 or Ubuntu OS higher than 20.04, you may find that the default GCC on your device is higher than gcc8. This will cause ninja build error. Because during the ninja build process, there is an attribute for nvcc that is cc=g++-8. So in this case, nvcc cannot find a correspond g++ on your device. You need to install a older gcc by yourself. Once you have done that, use command ‘gcc -v’ to check your current gcc version.

When you done all the things mentioned above, your training process should be able to run successfully. If not, you might want to check if your environment variables are set correctly.


You must be logged in to post a comment.


pix pix pix pix pix pix


杨文龙,微软Principal Engineering Manager, 曾在各家公司担任影像技术资深总监、数据科学团队资深经理、ADAS算法总监、资深深度学习工程师等职位,热爱创新发明,专注于人工智能、深度学习、图像处理、机器学习、算法、自然语言处理及软件等领域,目前发明有国际专利19篇,中国专利28篇。



2015 in Shanghai