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

Running musicnn_test.ipynb throws exception #10

Open
botkevin opened this issue Aug 4, 2020 · 0 comments
Open

Running musicnn_test.ipynb throws exception #10

botkevin opened this issue Aug 4, 2020 · 0 comments

Comments

@botkevin
Copy link

botkevin commented Aug 4, 2020

When taggram, tags = extractor(file_name, model='MTT_musicnn', extract_features=False) is run, this warning is repeated multiple times:

WARNING: Entity <bound method Dropout.call of <tensorflow.python.layers.core.Dropout object at 0x7f9a3e22e240>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method Dropout.call of <tensorflow.python.layers.core.Dropout object at 0x7f9a3e22e240>>: AssertionError: Bad argument number for Name: 3, expecting 4

and am given error:

RuntimeError                              Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/librosa/core/audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
    145     try:
--> 146         with sf.SoundFile(path) as sf_desc:
    147             sr_native = sf_desc.samplerate

~/.local/lib/python3.6/site-packages/soundfile.py in __init__(self, file, mode, samplerate, channels, subtype, endian, format, closefd)
    628                                          format, subtype, endian)
--> 629         self._file = self._open(file, mode_int, closefd)
    630         if set(mode).issuperset('r+') and self.seekable():

~/.local/lib/python3.6/site-packages/soundfile.py in _open(self, file, mode_int, closefd)
   1183         _error_check(_snd.sf_error(file_ptr),
-> 1184                      "Error opening {0!r}: ".format(self.name))
   1185         if mode_int == _snd.SFM_WRITE:

~/.local/lib/python3.6/site-packages/soundfile.py in _error_check(err, prefix)
   1356         err_str = _snd.sf_error_number(err)
-> 1357         raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
   1358 

RuntimeError: Error opening './audio/joram-moments_of_clarity-08-solipsism-59-88.mp3': File contains data in an unknown format.

During handling of the above exception, another exception occurred:

NoBackendError                            Traceback (most recent call last)
<ipython-input-2-f690f5bcff5c> in <module>
      1 from musicnn.extractor import extractor
----> 2 taggram, tags, features = extractor(file_name, model='MTT_musicnn', extract_features=True)

~/Documents/musicnn/musicnn/extractor.py in extractor(file_name, model, input_length, input_overlap, extract_features)
    156     # batching data
    157     print('Computing spectrogram (w/ librosa) and tags (w/ tensorflow)..', end =" ")
--> 158     batch, spectrogram = batch_data(file_name, n_frames, overlap)
    159 
    160     # tensorflow: extract features and tags

~/Documents/musicnn/musicnn/extractor.py in batch_data(audio_file, n_frames, overlap)
     39 
     40     # compute the log-mel spectrogram with librosa
---> 41     audio, sr = librosa.load(audio_file, sr=config.SR)
     42     audio_rep = librosa.feature.melspectrogram(y=audio, 
     43                                                sr=sr,

~/.local/lib/python3.6/site-packages/librosa/core/audio.py in load(path, sr, mono, offset, duration, dtype, res_type)
    161         if isinstance(path, (str, pathlib.PurePath)):
    162             warnings.warn("PySoundFile failed. Trying audioread instead.")
--> 163             y, sr_native = __audioread_load(path, offset, duration, dtype)
    164         else:
    165             raise (exc)

~/.local/lib/python3.6/site-packages/librosa/core/audio.py in __audioread_load(path, offset, duration, dtype)
    185 
    186     y = []
--> 187     with audioread.audio_open(path) as input_file:
    188         sr_native = input_file.samplerate
    189         n_channels = input_file.channels

~/.local/lib/python3.6/site-packages/audioread/__init__.py in audio_open(path, backends)
    114 
    115     # All backends failed!
--> 116     raise NoBackendError()

NoBackendError: 

Based on the FAQ, there seems to be a problem with librosa soundread and audioread

Running the vgg_example yields the same warning, but outputs the correct taggram

However, when I switched musicnn_example to opening filename='./audio/TRWJAZW128F42760DD_test.mp3' from './audio/joram-moments_of_clarity-08-solipsism-59-88.mp3', the warning is still raised, but a taggram does show. Perhaps this is a problem with my version of librosa, because it seems that 'joram...mp3' cannot be opened. Openning 'TRW...mp3' yields me the warning /home/kevin/.local/lib/python3.6/site-packages/librosa/core/audio.py:162: UserWarning: PySoundFile failed. Trying audioread instead. warnings.warn("PySoundFile failed. Trying audioread instead.") which is consistent with the FAQ.

However, the Autgograph warning seems to be a different problem altogether.

@botkevin botkevin changed the title Running musicnn_test.ipynb yields warning Running musicnn_test.ipynb throws exception Aug 4, 2020
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

1 participant