Hi, everyone. I’m trying to run the very first example from this page: What is Audio-to-Audio? - Hugging Face
The code is very simple, just three lines:
from speechbrain.pretrained import SpectralMaskEnhancement
model = SpectralMaskEnhancement.from_hparams("speechbrain/mtl-mimic-voicebank")
model.enhance_file("sample_data/sp03_keyboard_sn0.wav")
Yet when I run it I get an error with the following stack trace:
TypeError Traceback (most recent call last)
<ipython-input-2-700e2dca0099> in <module>()
1 from speechbrain.pretrained import SpectralMaskEnhancement
2 model = SpectralMaskEnhancement.from_hparams("speechbrain/mtl-mimic-voicebank")
----> 3 model.enhance_file("sample_data/sp03_keyboard_sn0.wav")
/usr/local/lib/python3.7/dist-packages/speechbrain/pretrained/interfaces.py in enhance_file(self, filename, output_filename)
2087 batch = noisy.unsqueeze(0)
2088 if lengths_arg_exists(self.enhance_batch):
-> 2089 enhanced = self.enhance_batch(batch, lengths=torch.tensor([1.0]))
2090 else:
2091 enhanced = self.enhance_batch(batch)
/usr/local/lib/python3.7/dist-packages/speechbrain/pretrained/interfaces.py in enhance_batch(self, noisy, lengths)
2063 # Perform masking-based enhancement, multiplying output with input.
2064 if lengths is not None:
-> 2065 mask = self.mods.enhance_model(noisy_features, lengths=lengths)
2066 else:
2067 mask = self.mods.enhance_model(noisy_features)
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
1100 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1101 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1102 return forward_call(*input, **kwargs)
1103 # Do not call functions when jit is used
1104 full_backward_hooks, non_full_backward_hooks = [], []
TypeError: forward() got an unexpected keyword argument 'lengths'
Could anyone help me understand what is going wrong here? Thanks in advance.