-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
'ConvTranspose1d' object has no attribute 'padding_mode' #182
Comments
This must be a pytorch bug. I am currently using torch 1.1.0.dev20190411 It appears that Conv1d inherits from _ConvNd, and that _ConvNd is the source of the padding_mode property. But I don't know why the inherited value doesn't show up. I commented out two sanity checks (looking for non 'zeroes') in ~/.local/lib/python3.6/site-packages/torch/nn/modules/conv.py Then I forced the branch which concluded that the other checks for circular must be False on two others. At that point, the code ran. [Edit] Inference is all nan for the waveglow_old.pt file provided in this repo, but the waveglow_256channels.pt linked in the waveglow repo works! |
Closing due to inactivity. |
Using
def forward(self, input):
if False: # self.padding_mode == 'circular'
expanded_padding = ((self.padding[0] + 1) // 2, self.padding[0] // 2)
return F.conv1d(F.pad(input, expanded_padding, mode='circular'),
self.weight, self.bias, self.stride,
_single(0), self.dilation, self.groups)
return F.conv1d(input, self.weight, self.bias, self.stride,
self.padding, self.dilation, self.groups)
@weak_script_method
def forward(self, input, output_size=None):
# type: (Tensor, Optional[List[int]]) -> Tensor
#if self.padding_mode != 'zeros':
# raise ValueError('Only `zeros` padding mode is supported for ConvTranspose1d')
output_padding = self._output_padding(input, output_size, self.stride, self.padding, self.kernel_size)
return F.conv_transpose1d(
input, self.weight, self.bias, self.stride, self.padding,
output_padding, self.groups, self.dilation) |
@rafaelvalle please reopen this issue, problem still exists, checked on Ubuntu 19.04 installing current versions of the packages from the |
iirc, this happens because the after some version pytorch adds 'padding_mode' to the attributes of Conv2d. It can be fixed by getting the saved weights and setting them on a clean model:
|
This probably also works:
|
Where to put this text of code. |
following @apsears and running this script from the terminal under tacotron2 folder helped me solve my problem. cd waveglow/ |
Which can be added under:
It will work well. |
I cloned latest repo, while trying inference.ipynb I got following error.
AttributeError Traceback (most recent call last)
in
1 with torch.no_grad():
----> 2 audio = waveglow.infer(mel_outputs_postnet, sigma=0.666)
3 ipd.Audio(audio[0].data.cpu().numpy(), rate=hparams.sampling_rate)
~/fabelizer/tacotron2/waveglow/glow_old.py in infer(self, spect, sigma)
171
172 def infer(self, spect, sigma=1.0):
--> 173 spect = self.upsample(spect)
174 # trim conv artifacts. maybe pad spec to kernel multiple
175 time_cutoff = self.upsample.kernel_size[0] - self.upsample.stride[0]
~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
492 result = self._slow_forward(*input, **kwargs)
493 else:
--> 494 result = self.forward(*input, **kwargs)
495 for hook in self._forward_hooks.values():
496 hook_result = hook(self, input, result)
~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py in forward(self, input, output_size)
640 def forward(self, input, output_size=None):
641 # type: (Tensor, Optional[List[int]]) -> Tensor
--> 642 if self.padding_mode != 'zeros':
643 raise ValueError('Only
zeros
padding mode is supported for ConvTranspose1d')644
~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py in getattr(self, name)
538 return modules[name]
539 raise AttributeError("'{}' object has no attribute '{}'".format(
--> 540 type(self).name, name))
541
542 def setattr(self, name, value):
AttributeError: 'ConvTranspose1d' object has no attribute 'padding_mode'
The text was updated successfully, but these errors were encountered: