rosinality / stylegan2-pytorch

Implementation of Analyzing and Improving the Image Quality of StyleGAN (StyleGAN 2) in PyTorch
MIT License
2.74k stars 623 forks source link

TypeError: upfirdn2d(): incompatible function arguments. #304

Open lavitaaaa opened 2 years ago

lavitaaaa commented 2 years ago

Thanks for your great project!

I meet with a problem when running this command: python generate.py --ckpt ./checkpoint/550000.pt

the detailed errors as follow: `Traceback (most recent call last): File "generate.py", line 84, in generate(args, g_ema, device, mean_latent) File "generate.py", line 17, in generate [sample_z], truncation=args.truncation, truncation_latent=mean_latent File "D:\Anaconda3\envs\pytorch1_8_0\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "D:\StyleGan2\stylegan2_pytorch\model.py", line 565, in forward out = conv1(out, latent[:, i], noise=noise1) File "D:\Anaconda3\envs\pytorch1_8_0\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "D:\StyleGan2\stylegan2_pytorch\model.py", line 368, in forward out = self.conv(input, style) File "D:\Anaconda3\envs\pytorch1_8_0\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "D:\StyleGan2\stylegan2_pytorch\model.py", line 289, in forward out = self.blur(out) File "D:\Anaconda3\envs\pytorch1_8_0\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "D:\StyleGan2\stylegan2_pytorch\model.py", line 95, in forward out = upfirdn2d(input, self.kernel, pad=self.pad) TypeError: upfirdn2d(): incompatible function arguments. The following argument types are supported:

  1. (arg0: at::Tensor, arg1: at::Tensor, arg2: int, arg3: int, arg4: int, arg5: int, arg6: int, arg7: int, arg8: int, arg9: int) -> at:: Tensor`

My environment: cuda11.0 cudnn8.0 pytorch1.8.0 python3.6

Thanks for helping me!

lavitaaaa commented 2 years ago

I solved this problem by renaming the "upfirdn2d.py" to "upfirdn2dpkg.py" and using pytorch1.9.0 (but i don't know why this method worked)