Skip to content
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

Torch / Torchlibrosa dependency issue #12

Open
arbelhizmi opened this issue Feb 27, 2023 · 1 comment
Open

Torch / Torchlibrosa dependency issue #12

arbelhizmi opened this issue Feb 27, 2023 · 1 comment

Comments

@arbelhizmi
Copy link

arbelhizmi commented Feb 27, 2023

I have a container that contain the following packages:

python = "3.9.6"
librosa = "0.8.0"
torch = "1.9.0+cu111"
torchaudio = "0.9.0"
torchlibrosa = "0.0.9"

When I change the versions torch, torchaudio to:

python = "3.9.6"
librosa = "0.8.0"
torch = "1.10.0+cu111"
torchaudio = "0.10.0"
torchlibrosa = "0.0.9"

I receive the following error:

UNAVAILABLE: Internal: TypeError: pad_center() takes 1 positional argument but 2 were given
At:
/usr/local/lib/python3.8/dist-packages/torchlibrosa/stft.py(193): __init__
/usr/local/lib/python3.8/dist-packages/torchlibrosa/stft.py(645): __init__

It seems like torchlibrosa=0.0.9 has some problem with torch=1.10.0+cu111.
Another problem is that in according to the documentation torchlibrosa=0.0.9 (or torchlibrosa in general) is not depends on any torch version.
According to the setup.py file (https://github.com/qiuqiangkong/torchlibrosa/blob/master/setup.py) these are the required packages:

install_requires=[
        'numpy',
        'librosa>=0.9.0'
    ]

No torch version is required.
When I open new environment that only has torchlibrosa=0.0.9 installed in it and run the example from the REAME file:

import torch
import torchlibrosa as tl

batch_size = 16
sample_rate = 22050
win_length = 2048
hop_length = 512
n_mels = 128

batch_audio = torch.empty(batch_size, sample_rate).uniform_(-1, 1)  # (batch_size, sample_rate)

# TorchLibrosa feature extractor the same as librosa.feature.melspectrogram()
feature_extractor = torch.nn.Sequential(
    tl.Spectrogram(
        hop_length=hop_length,
        win_length=win_length,
    ), tl.LogmelFilterBank(
        sr=sample_rate,
        n_mels=n_mels,
        is_log=False, # Default is true
    ))
batch_feature = feature_extractor(batch_audio) # (batch_size, 1, time_steps, mel_bins)

The following error is raised:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 1, in <module>
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'torch'

To conclude, it seems like there two problems:

  1. The documentation of torchlibrosa doesn't mention torch as a "must" requirement even though it should be a must requirement
  2. There is a problem with torchlibrosa=0.0.9 that is working with torch=1.10.0+cu111
@Abdul-Melik
Copy link

Any update on this? I have the same error relating to the pad_center function, i have torch 1.11.0 and torchlibrosa 0.0.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants