felixfuyihui / Uformer

Uformer: A Unet based dilated complex & real dual-path conformer network for simultaneous speech enhancement and dereverberation
94 stars 16 forks source link

Question about torch version #2

Open yjw123456 opened 2 years ago

yjw123456 commented 2 years ago

Hi felix, Thanks for sharing this project, great work! I encountered some issues when running your code directly by: python uformer.py I have tried torch version from 1.8.1 to 1.10.

In trans.py I need to change line 85 K = th.fft.fft(I / S, 1) to K = th.view_as_real(th.fft.fft(I / S, 1)).squeeze(2)

Then in dsconv2d_cplx.py I meet Traceback (most recent call last): File "uformer.py", line 451, in outputs = net(inputs,inputs) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "uformer.py", line 336, in forward out, mag = self.conformer1(out, mag) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/apdcephfs/share_1149801/speech_user/tomasyu/experiment/frontend/Enhancement-Paas/ENHPAAS/model/UFORMER/Uformer/dilated_dualpath_conformer.py", line 118, in forward cplx = self.dsconv_cplxidx File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/apdcephfs/share_1149801/speech_user/tomasyu/experiment/frontend/Enhancement-Paas/ENHPAAS/model/UFORMER/Uformer/dsconv2d_cplx.py", line 48, in forward y = self.layernorm_conv1(x.transpose(2,4)).transpose(2,4) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/normalization.py", line 171, in forward input, self.normalized_shape, self.weight, self.bias, self.eps) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/functional.py", line 2205, in layer_norm return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled) RuntimeError: Given normalized_shape=[12], expected input with shape [, 12], but got input of size[10, 64, 2, 749, 5]

Can you give me some clues.

Bests, tomasyu

felixfuyihui commented 2 years ago

Hi felix, Thanks for sharing this project, great work! I encountered some issues when running your code directly by: python uformer.py I have tried torch version from 1.8.1 to 1.10.

In trans.py I need to change line 85 K = th.fft.fft(I / S, 1) to K = th.view_as_real(th.fft.fft(I / S, 1)).squeeze(2)

Then in dsconv2d_cplx.py I meet Traceback (most recent call last): File "uformer.py", line 451, in outputs = net(inputs,inputs) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "uformer.py", line 336, in forward out, mag = self.conformer1(out, mag) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/apdcephfs/share_1149801/speech_user/tomasyu/experiment/frontend/Enhancement-Paas/ENHPAAS/model/UFORMER/Uformer/dilated_dualpath_conformer.py", line 118, in forward cplx = self.dsconv_cplxidx File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/apdcephfs/share_1149801/speech_user/tomasyu/experiment/frontend/Enhancement-Paas/ENHPAAS/model/UFORMER/Uformer/dsconv2d_cplx.py", line 48, in forward y = self.layernorm_conv1(x.transpose(2,4)).transpose(2,4) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(_input, **kwargs) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/modules/normalization.py", line 171, in forward input, self.normalized_shape, self.weight, self.bias, self.eps) File "/data/tools/anaconda3/envs/uformer/lib/python3.7/site-packages/torch/nn/functional.py", line 2205, in layer_norm return torch.layer_norm(input, normalized_shape, weight, bias, eps, torch.backends.cudnn.enabled) RuntimeError: Given normalizedshape=[12], expected input with shape [, 12], but got input of size[10, 64, 2, 749, 5]

Can you give me some clues.

Bests, tomasyu

Hi dear Tomasyu

Thank you so much for finding out the bug. It's my carelessness. Please use 1.10. The code should be: K = th.fft.fft(I / S, 1) K = th.cat([K.real, K.imag], -1) I've already modified the code in the git. Thank you again for your attention.

Best regards,

Yihui