music-classification / tutorial

2021 ISMIR tutorial - music classification
143 stars 14 forks source link

Import Error about library"torchaudio_augmentations" in colab #28

Open ghost opened 2 years ago

ghost commented 2 years ago

Hi, first I would like to say thank you very much for the tutorial, it's really great. :)

I'm trying to implement the code from the tutorial into colab, but it seems that in “Audio Data Augmentations” subsection, the import encounters problems with cuda version compatibility, I'm not quite sure what's going on, could you please take a look at it?

Here is my colab note: https://colab.research.google.com/drive/1Df2-yf9-tSnYUo8juIhfLTvhSto5Bk7F?authuser=2#scrollTo=GezaZlg7kqgx&line=5&uniqifier=1

Spijkervet commented 2 years ago

Hi there! Thanks for reporting the issue. I've taken a look at your stack trace, and it says that it has problems loading torchaudio's Vol class. This may have to do that your torchaudio version does not match the compiled torch version in your notebook. I would recommend doing a pip3 install torch torchaudio --upgrade.

(copying the stack trace for reference here:)

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-30-28549e3b5dfb> in <module>()
      6 import torch
      7 from torch.utils import data
----> 8 from torchaudio_augmentations import (
      9     Compose,
     10     Delay,

6 frames
/usr/local/lib/python3.7/dist-packages/torchaudio_augmentations/__init__.py in <module>()
      2 from .compose import Compose, ComposeMany
      3 from .augmentations.delay import Delay
----> 4 from .augmentations.gain import Gain
      5 from .augmentations.high_low_pass import HighLowPass
      6 from .augmentations.noise import Noise

/usr/local/lib/python3.7/dist-packages/torchaudio_augmentations/augmentations/gain.py in <module>()
      1 import torch
      2 import random
----> 3 from torchaudio.transforms import Vol
      4 
      5 

/usr/local/lib/python3.7/dist-packages/torchaudio/__init__.py in <module>()
----> 1 from torchaudio import _extension  # noqa: F401
      2 from torchaudio import (
      3     compliance,
      4     datasets,
      5     functional,

/usr/local/lib/python3.7/dist-packages/torchaudio/_extension.py in <module>()
     25 
     26 
---> 27 _init_extension()

/usr/local/lib/python3.7/dist-packages/torchaudio/_extension.py in _init_extension()
     19     # which depends on `libtorchaudio` and dynamic loader will handle it for us.
     20     if path.exists():
---> 21         torch.ops.load_library(path)
     22         torch.classes.load_library(path)
     23     # This import is for initializing the methods registered via PyBind11

/usr/local/lib/python3.7/dist-packages/torch/_ops.py in load_library(self, path)
    108             # static (global) initialization code in order to register custom
    109             # operators with the JIT.
--> 110             ctypes.CDLL(path)
    111         self.loaded_libraries.add(path)
    112 

/usr/lib/python3.7/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    362 
    363         if handle is None:
--> 364             self._handle = _dlopen(self._name, mode)
    365         else:
    366             self._handle = handle

OSError: libcudart.so.10.2: cannot open shared object file: No such file or directory