mazzzystar / WaveGAN-pytorch

PyTorch implementation of " Synthesizing Audio with Generative Adversarial Networks"
https://arxiv.org/abs/1802.04208
64 stars 15 forks source link

RuntimeError: Mismatch in shape: grad_output[0] has a shape of torch.Size([1]) and output[0] has a shape of torch.Size([]). #9

Open Tylersuard opened 4 years ago

Tylersuard commented 4 years ago

Traceback (most recent call last): File "train.py", line 124, in D_real.backward(neg_one) # loss * -1 File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 195, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 93, in backward grad_tensors = _make_grads(tensors, grad_tensors) File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 29, in _make_grads

DWhettam commented 4 years ago

Any luck with this issue? I've tried training on the piano data and I'm getting the same issue. I'm running on a cluster so not able to put the training data in the same directory as the code, but I've specified the directory in args.audio_dir

DWhettam commented 4 years ago

Resolved: change one = torch.Tensor([1]).float() to one = torch.tensor(1, dtype=torch.float) on line 104.

I also had to change to change the print statement on line 213 to do non-integer division: if i % (BATCH_NUM / 5) == 0:

mazzzystar commented 4 years ago

Hi, sorry for the late response. The implementation was done in 2018, so I think this should be PyTorch version issue.

sandip-baidya commented 3 years ago

Hey, the fix worked but all the samples generated after training don't carry any sounds at all. I don't know why that's happening. Was there a problem during converting them from numpy arrays to .wav files?