Skip to content

Can not use Stylegan3 to generate images. #142

Open
@zydjohnHotmail

Description

@zydjohnHotmail

Hello:
I tried to follow the instruction to install Stylegan3 and generate some images. I am using Python 3.9.7 on Windows 10.
First, I used conda to install all the packages, but I found the requirement.yml seems not correct.
For my Windows 10 environment.
If you install pytorch (version 1.9.1), the default pytorch package is without cuda toolkit. And ninja package seem not working either. So I have to delete pytorch and ninja from the requiement.yml, then install them after I activate the environment. However, I still have issue when I tried to generate some images.
Then, I decided to simply use pip to install all necessary packages one by one, starting from ninja, then pytorch with cuda, then other packages.
Now, I have installed all necessary packages:

(stylegan3-main) F:\Python\stylegan3-main>pip list
Package Version


certifi 2021.10.8
charset-normalizer 2.0.12
click 8.0.4
colorama 0.4.4
cycler 0.11.0
fonttools 4.31.2
glfw 2.5.1
idna 3.3
imageio 2.16.1
imageio-ffmpeg 0.4.5
imgui 1.4.1
kiwisolver 1.4.0
matplotlib 3.5.1
ninja 1.10.2.3
numpy 1.22.3
packaging 21.3
Pillow 9.0.1
pip 22.0.4
PyOpenGL 3.1.6
pyparsing 3.0.7
pyspng 0.1.0
python-dateutil 2.8.2
requests 2.27.1
scipy 1.8.0
setuptools 57.4.0
six 1.16.0
torch 1.11.0+cu113
torchaudio 0.11.0+cu113
torchvision 0.12.0+cu113
tqdm 4.63.0
typing_extensions 4.1.1
urllib3 1.26.9

Then I created one folder: F:\Python\stylegan3-main\out
Finally, I run the command to generate the images:

(stylegan3-main) F:\Python\stylegan3-main>python gen_images.py --outdir=out --trunc=1 --seeds=2 --network=https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan3/versions/1/files/stylegan3-r-afhqv2-512x512.pkl
Loading networks from "https://api.ngc.nvidia.com/v2/models/nvidia/research/stylegan3/versions/1/files/stylegan3-r-afhqv2-512x512.pkl"...
Generating image for seed 2 (0/1) ...
Setting up PyTorch plugin "bias_act_plugin"... Failed!
Traceback (most recent call last):
File "F:\Python\stylegan3-main\lib\site-packages\torch\utils\cpp_extension.py", line 1740, in _run_ninja_build
subprocess.run(
File "C:\Program Files\Python39\lib\subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

I always failed with F:\Python\stylegan3-main\lib\site-packages\torch\utils\cpp_extension.py
Any suggestions?
By the way, is there any working Stylegan3 or Stylegan2 pre-trained model I can use in Windows 10 environment?
My Windows 10 version is: Version 21H2 (OS Build 19044.1586). I think most of the people on Windows 10 are using this version, except some people already migrated to Windows 11.
I am using Python 3.9.7 (x64) on Windows 10, as I believe most of the python packages work in Python 3.9; only some of them work in Python 3.10.
So, my issue could represent quite a number of people are using Windows.
Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions