stylegan2-pytorch
stylegan2-pytorch copied to clipboard
How to use conv2d_gradfix in high version?
I try to use my own dataset. But there is a warning here?
0%| | 0/800000 [00:00<?, ?it/s]/project/GAN/stylegan2-pytorch/op/conv2d_gradfix.py:89: UserWarning: conv2d_gradfix not supported on PyTorch 1.6.0. Falling back to torch.nn.functional.conv2d(). f"conv2d_gradfix not supported on PyTorch {torch.version}. Falling back to torch.nn.functional.conv2d()."
What can I change to make the code work? Thank you!
You need to use pytorch 1.7+.
But I use pytorch 1.9. The warning is same.
project/experiment/stylegan2/op/conv2d_gradfix.py:89: UserWarning: conv2d_gradfix not supported on PyTorch 1.9.0. Falling back to torch.nn.functional.conv2d(). f"conv2d_gradfix not supported on PyTorch {torch.version}. Falling back to torch.nn.functional.conv2d()."
I haven't test it on pytorch 1.9, but I think you can add it to https://github.com/rosinality/stylegan2-pytorch/blob/master/op/conv2d_gradfix.py#L85 this line and I guess it will work.
Hi @rosinality , Would that hurt the generation quality if I directly use the torch.nn.functional.conv2d() instead of the conv2d_gradfix? I am waiting for your reply! Thank you!
I haven't test it on pytorch 1.9, but I think you can add it to https://github.com/rosinality/stylegan2-pytorch/blob/master/op/conv2d_gradfix.py#L85 this line and I guess it will work.
I also found similar problems, and I also used pytorch 1.12.1

python finetune_stylegan.py --iter 600 --batch 4 --size 1024 --ckpt ./checkpoint/stylegan2-ffhq-config-f.pt --style fantasy --augment ./data/fantasy/lmdb/ Load options ada_every: 256 ada_length: 500000 ada_target: 0.6 augment: True augment_p: 0 batch: 4 channel_multiplier: 2 ckpt: ./checkpoint/stylegan2-ffhq-config-f.pt d_reg_every: 16 g_reg_every: 4 iter: 600 local_rank: 0 lr: 0.002 mixing: 0.9 model_path: ./checkpoint/ n_sample: 9 path: ./data/fantasy/lmdb/ path_batch_shrink: 2 path_regularize: 2 r1: 10 save_every: 10000 size: 1024 style: fantasy wandb: False
load model: ./checkpoint/stylegan2-ffhq-config-f.pt
0%| | 0/600 [00:00<?, ?it/s]/root/DualStyleGAN/model/stylegan/op/conv2d_gradfix.py:88: UserWarning: conv2d_gradfix not supported on PyTorch 1.12.1. Falling back to torch.nn.functional.conv2d().
warnings.warn(
0%| | 0/600 [00:02<?, ?it/s]
Traceback (most recent call last):
File "finetune_stylegan.py", line 391, in