-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not use Stylegan3 to generate images. #142
Comments
Forgive me if this is obvious or redundant, but there are some hints/guides on making the network compile and run in Windows. For example, the Requirements tells you what to do with VS and what to add to your Since it's the "bias_act_plugin" that fails, most likely it has to do with errors during the installation of VSCode. For example, @nipponjo and @felkoh in issue #124 note that you shouldn't have two VS versions installed and that you should remove one (I've also used the 2019 version before and I haven't had issues with it either). For the package installations, there have been some fixes/additions, for example @edstoica's PR #116, where you change |
Hello: However, I doubted about the hardware issue. My PC has one NVIDIA GEFORCE GT1030 graphic card. This card seems to be able to install cuda toolkit, but NVIDIA didn't even list it as supported product for cuda programming. |
@nurpax found out how to do this in StyleGAN2-ADA: you just need to set First, you could either hard set the device = torch.device('cuda') if torch.cuda.is_available() and device == 'cuda' else torch.device('cpu') or just do if device.type == 'cpu':
import functools
G.forward = functools.partial(G.forward, force_fp32=True) That's it. There's no need to compile the custom CUDA kernels, and it just goes straight to the image synthesis, assuming that's what you have next. Note that it will take a lot longer, which depends on the specifications of your machine. |
Hi, (stylegan3) F:\Python\GAN3\stylegan3>dir out Directory of F:\Python\GAN3\stylegan3\out 03/26/2022 10:19 PM .03/26/2022 10:19 PM .. 03/26/2022 10:19 PM 518,833 seed0002.png 1 File(s) 518,833 bytes 2 Dir(s) 5,015,626,403,840 bytes free (stylegan3) F:\Python\GAN3\stylegan3> |
Yeah, the image looks good, so you should see how to generate images with the presented parameters. Regarding generating a target image, that's called projection and it has been part of StyleGAN since StyleGAN2, so check those repositories for code. You won't be able to get perfect projection because well, that's not the point of StyleGAN in general unless you force it beyond what the Generator should normally be able to synthesize. |
Hello: Generate images using pretrained network pickle. Examples: Generate an image using pre-trained AFHQv2 model ("Ours" in Figure 1, left).python gen_images.py --outdir=out --trunc=1 --seeds=2 Generate uncurated images with truncation using the MetFaces-U datasetpython gen_images.py --outdir=out --trunc=0.7 --seeds=600-605 Options: (stylegan3) F:\Python\GAN3\stylegan3> |
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,
The text was updated successfully, but these errors were encountered: