qiuqiangkong / torchlibrosa

MIT License
450 stars 45 forks source link

pad_center() takes 1 positional argument but 2 were given #7

Closed chichixdf closed 1 year ago

chichixdf commented 2 years ago

when use python3.7, this problem occurred: pad_center() takes 1 positional argument but 2 were given, when use python3.6, everything is just fine how to solve this? i need to use python3.7

MrNeo28 commented 2 years ago

`--------------------------------------------------------------------------- TypeError Traceback (most recent call last) /tmp/ipykernel_59/3969491226.py in ----> 1 Model = BirdsSED()

/tmp/ipykernel_59/879864623.py in init(self, base_model_name, pretrained, num_classes, in_channels) 177 self.spectrogram_extractor = Spectrogram(n_fft=n_fft, hop_length=hop_length, 178 win_length=n_fft, window="hann", center=True, pad_mode="reflect", --> 179 freeze_parameters=True) 180 181 # Logmel feature extractor

/opt/conda/lib/python3.7/site-packages/torchlibrosa/stft.py in init(self, n_fft, hop_length, win_length, window, center, pad_mode, power, freeze_parameters) 645 self.stft = STFT(n_fft=n_fft, hop_length=hop_length, 646 win_length=win_length, window=window, center=center, --> 647 pad_mode=pad_mode, freeze_parameters=True) 648 649 def forward(self, input):

/opt/conda/lib/python3.7/site-packages/torchlibrosa/stft.py in init(self, n_fft, hop_length, win_length, window, center, pad_mode, freeze_parameters) 191 192 # Pad the window out to n_fft size. --> 193 fft_window = librosa.util.pad_center(fft_window, n_fft) 194 195 # DFT & IDFT matrix.

TypeError: pad_center() takes 1 positional argument but 2 were given`

I am also getting same error!

KoenT-SS commented 2 years ago

Today, I also noticed the following warning, which seems to be the same issue (torchlibrosa version 0.0.9, with pytorch 1.11.0 and librosa 0.9.1):

<snip>lib/python3.9/site-packages/torchlibrosa/stft.py:193: FutureWarning: Pass size=1024 as keyword args. From version 0.10 passing these as positional arguments will result in an error
          fft_window = librosa.util.pad_center(fft_window, n_fft)