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

drum transcribe doesn't work on MacOS #38

Open
keunwoochoi opened this issue Aug 11, 2021 · 19 comments
Open

drum transcribe doesn't work on MacOS #38

keunwoochoi opened this issue Aug 11, 2021 · 19 comments
Labels
bug Something isn't working

Comments

@keunwoochoi
Copy link

(it's a part of the JOSS review - openjournals/joss-reviews#3391)

I'm having the same error regardless of the audio type (mp3, wav).

Traceback (most recent call last):
  File "/Users/admin/miniconda3/envs/omnizart/bin/omnizart", line 8, in <module>
    sys.exit(entry())
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/cli/drum/transcribe.py", line 28, in transcribe
    drum.app.transcribe(input_audio, model_path, output=output)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/utils.py", line 328, in __getattr__
    module = self._load()
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/utils.py", line 313, in _load
    module = importlib.import_module(self.__name__)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/drum/__init__.py", line 37, in <module>
    from omnizart.drum.app import DrumTranscription
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/drum/app.py", line 12, in <module>
    from omnizart.feature.wrapper_func import extract_patch_cqt
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/feature/wrapper_func.py", line 7, in <module>
    from omnizart.feature.beat_for_drum import extract_mini_beat_from_audio_path
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/feature/beat_for_drum.py", line 8, in <module>
    from madmom.features import (
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/madmom/__init__.py", line 24, in <module>
    from . import audio, evaluation, features, io, ml, models, processors, utils
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/madmom/audio/__init__.py", line 27, in <module>
    from . import comb_filters, filters, signal, spectrogram, stft
  File "madmom/audio/comb_filters.pyx", line 1, in init madmom.audio.comb_filters
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject

I confirmed that it works without any issue on Linux.

@keunwoochoi
Copy link
Author

A similar issue with chord transcription, also on MacOS.

RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):
  File "/Users/admin/miniconda3/envs/omnizart/bin/omnizart", line 8, in <module>
    sys.exit(entry())
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/cli/chord/transcribe.py", line 16, in transcribe
    chord.app.transcribe(input_audio, model_path=model_path, output=output)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/utils.py", line 328, in __getattr__
    module = self._load()
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/utils.py", line 313, in _load
    module = importlib.import_module(self.__name__)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/chord/__init__.py", line 32, in <module>
    from omnizart.chord.app import ChordTranscription
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/chord/app.py", line 14, in <module>
    from omnizart.feature.chroma import extract_chroma
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/feature/chroma.py", line 1, in <module>
    import vamp
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/vamp/__init__.py", line 163, in <module>
    import vampyhost
ImportError: numpy.core.multiarray failed to import

@keunwoochoi
Copy link
Author

This is my pip freeze. Python 3.7.10.

absl-py==0.13.0
appdirs==1.4.4
astunparse==1.6.3
attrs==21.2.0
audioread==2.1.9
cachetools==4.2.2
certifi==2021.5.30
cffi==1.14.6
charset-normalizer==2.0.3
click==7.1.2
Cython==0.29.24
decorator==5.0.9
ffmpeg-python==0.2.0
future==0.18.2
gast==0.3.3
google-auth==1.34.0
google-auth-oauthlib==0.4.5
google-pasta==0.2.0
grpcio==1.39.0
h11==0.12.0
h2==3.2.0
h5py==2.10.0
hpack==3.0.0
httpcore==0.12.3
httpx==0.16.1
hyperframe==5.2.0
idna==3.2
importlib-metadata==3.10.1
joblib==1.0.1
jsonschema==3.2.0
Keras-Preprocessing==1.1.2
librosa==0.8.0
llvmlite==0.31.0
madmom==0.16.1
Markdown==3.3.4
mido==1.2.10
mir-eval==0.6
norbert==0.2.1
numba==0.48.0
numpy==1.18.5
oauthlib==3.1.1
omnizart==0.4.1
opencv-python==4.5.3.56
opt-einsum==3.3.0
packaging==21.0
pandas==1.1.2
pooch==1.4.0
pretty-midi==0.2.9
protobuf==3.17.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pyFluidSynth==1.3.0
pyparsing==2.4.7
pyrsistent==0.18.0
python-dateutil==2.8.2
pytz==2021.1
PyYAML==5.4.1
requests==2.26.0
requests-oauthlib==1.3.0
resampy==0.2.2
rfc3986==1.5.0
rsa==4.7.2
samidata-pt @ git+ssh://[email protected]/lab-audio/samidata_pt.git@0e78dbbc1d0772bea7d97413afc308ee5521b548
scikit-learn==0.24.2
scipy==1.4.1
six==1.16.0
sniffio==1.2.0
SoundFile==0.10.3.post1
spleeter==2.2.2
tensorboard==2.5.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorflow==2.3.0
tensorflow-estimator==2.3.0
termcolor==1.1.0
threadpoolctl==2.2.0
tqdm==4.61.2
typer==0.3.2
typing-extensions==3.10.0.0
urllib3==1.26.4
vamp==1.1.0
Werkzeug==2.0.1
wrapt==1.12.1
zipp==3.5.0

@keunwoochoi
Copy link
Author

I have no idea how easy it'd be for you to fix this issue. But there're a lot of mac users among researchers/developers. At least you'd want to add some warning and clarify which on platform it works.

@BreezeWhite
Copy link
Member

That is strange... The second one looks like the issue related to vamp package, which is originally written in C and then ported to python. I'm not sure whether it is related to the problem of python version compatibility, and if so, there is little I can do to this issue though.
And for the first situation, unfortunately, I don't have a Mac to test and debug. So the best approach would be just as you mentioned, remind the user there could be such problem on Mac in the documentation.

@keunwoochoi
Copy link
Author

Sounds good to me. Once the documentation is updated, I'll close this issue!

@faroit
Copy link
Contributor

faroit commented Aug 20, 2021

@BreezeWhite @keunwoochoi I can confirm that the the omnizart doesn't run on macOS (ARM M1 Mac). I managed to install the dependencies using:

conda create -p ./env python=3.8
conda activate /Users/faro/omnizart/env
pip install numpy cython
pip install .

but then running any omnizart command makes it crash:

env ❯ omnizart                                                                                                      (/Users/faro/omnizart/env)
fish: Job 1, 'omnizart' terminated by signal SIGILL (Illegal instruction)

i also tried using python 3.7

I will try again on an Intel Mac

@BreezeWhite
Copy link
Member

BreezeWhite commented Aug 22, 2021

It seems like this issue can be fixed simply by reinstalling the numpy package according to the answer here, which also worked on my machine. Though the requirement by spleeter 2.2.2 and tensorflow 2.3.0 is numpy<1.19.0, which conflicts with this re-installation.

@faroit
Copy link
Contributor

faroit commented Aug 22, 2021

It seems like this issue can be fixed simply by reinstalling the numpy package according to the answer here, which also worked on my machine. Though the requirement by spleeter 2.2.2 and tensorflow 2.3.0 is numpy<1.19.0, which conflicts with this re-installation.

that doesn't fix my issue. I tried reinstalling several versions of numpy <1.19.0

@BreezeWhite
Copy link
Member

It worked for me by upgrading numpy to the newest version and ignoring the requirement errors. It could still execute without any further errors.

@faroit
Copy link
Contributor

faroit commented Aug 22, 2021

also no luck using docker

2021-08-22 12:57:33.615485: F tensorflow/core/lib/monitoring/sampler.cc:42] Check failed: bucket_limits_[i] > bucket_limits_[i - 1] (0 vs. 10)
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

@faroit
Copy link
Contributor

faroit commented Aug 22, 2021

It worked for me by upgrading numpy to the newest version and ignoring the requirement errors. It could still execute without any further errors.

tried that as well. same error. As I said, I will try on an Intel Mac later. It looks like tf 2.3 doesn't run on ARM macos at all. Maybe you should note that in the readme

@faroit
Copy link
Contributor

faroit commented Aug 23, 2021

Okay, I can verify it on an intel mac now. I can also confirm that it runs fine when upgrading to numpy>=1.20.0

@faroit
Copy link
Contributor

faroit commented Aug 23, 2021

@BreezeWhite the issue is related to an issue in madmom and is already fixed in CPJKU/madmom#474 I suggest you update to that version of madmom once its released and close the issue then.

@BreezeWhite
Copy link
Member

@faroit thanks for the update. I will keep track on that issue. I will also update the README mentioning that Omnizart is currently not compatible for ARM macos.

@keunwoochoi
Copy link
Author

keunwoochoi commented Aug 24, 2021

on my intel mac, it works once i manually upgrade numpy to the newest version (1.21.2). @BreezeWhite please update us once you update the madmom version in Omnizart.

EDIT: Drum/music transcription worked. Chord didn't.

(omnizart) ➜  Downloads omnizart drum transcribe "yt1s.com - Nirvana  In Bloom.mp3"
2021-08-24 12:38:09 Extracting feature...
/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/madmom/features/downbeats.py:287: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  best = np.argmax(np.asarray(results)[:, 1])
/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/madmom/features/downbeats.py:287: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
  best = np.argmax(np.asarray(results)[:, 1])
2021-08-24 12:39:33 Loading model...
2021-08-24 12:39:33 Using built-in model /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/checkpoints/drum/drum_keras for transcription.
2021-08-24 12:39:34 Predicting...
2021-08-24 12:40:39 Infering MIDI...
2021-08-24 12:40:40 MIDI file has been written to ./yt1s.com - Nirvana  In Bloom.mid.
2021-08-24 12:40:40 Transcription finished
(omnizart) ➜  Downloads omnizart chord transcribe "yt1s.com - Nirvana  In Bloom.mp3"
2021-08-24 12:47:36 Extracting feature
2021-08-24 12:47:41 Loading model
2021-08-24 12:47:41 Using built-in model /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/checkpoints/chord/chord_v1 for transcription.
2021-08-24 12:47:41 Preparing feature for model prediction
2021-08-24 12:47:41 Predicting...
Traceback (most recent call last):
  File "/Users/admin/miniconda3/envs/omnizart/bin/omnizart", line 8, in <module>
    sys.exit(entry())
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/cli/chord/transcribe.py", line 16, in transcribe
    chord.app.transcribe(input_audio, model_path=model_path, output=output)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/chord/app.py", line 79, in transcribe
    chord, _, _, _ = model.predict(segments_pad)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 130, in _method_wrapper
    return method(self, *args, **kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 1599, in predict
    tmp_batch_outputs = predict_function(iterator)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 780, in __call__
    result = self._call(*args, **kwds)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 823, in _call
    self._initialize(args, kwds, add_initializers_to=initializers)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 697, in _initialize
    *args, **kwds))
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 2855, in _get_concrete_function_internal_garbage_collected
    graph_function, _, _ = self._maybe_define_function(args, kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 3213, in _maybe_define_function
    graph_function = self._create_graph_function(args, kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/eager/function.py", line 3075, in _create_graph_function
    capture_by_value=self._capture_by_value),
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/framework/func_graph.py", line 986, in func_graph_from_py_func
    func_outputs = python_func(*func_args, **func_kwargs)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py", line 600, in wrapped_fn
    return weak_wrapped_fn().__wrapped__(*args, **kwds)
  File "/Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/framework/func_graph.py", line 973, in wrapper
    raise e.ag_error_metadata.to_exception(e)
NotImplementedError: in user code:

    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py:1462 predict_function  *
        return step_function(self, iterator)
    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/models/chord_model.py:540 call  *
        encoder_input_emb, chord_change_logits, chord_change_pred = self.encoder(feature, slope=self.slope)
    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/omnizart/models/chord_model.py:302 call  *
        weighted_hidden_enc = tf.zeros(shape=shape_list(segment_encodings))
    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py:201 wrapper  **
        return target(*args, **kwargs)
    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py:2747 wrapped
        tensor = fun(*args, **kwargs)
    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py:2794 zeros
        output = _constant_if_small(zero, shape, dtype, name)
    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py:2732 _constant_if_small
        if np.prod(shape) < 1000:
    <__array_function__ internals>:6 prod

    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/numpy/core/fromnumeric.py:3052 prod
        keepdims=keepdims, initial=initial, where=where)
    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/numpy/core/fromnumeric.py:86 _wrapreduction
        return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
    /Users/admin/miniconda3/envs/omnizart/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:848 __array__
        " a NumPy call, which is not supported".format(self.name))

    NotImplementedError: Cannot convert a symbolic Tensor (chord_model/encoder/strided_slice_1:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported

@gergol
Copy link

gergol commented Sep 30, 2021

I have the same issue on my AMD linux machine (Ubuntu 20.04, AMD Ryzen 3950X processor). With a clean install I get the same error as the OP (with the vocal transcriber) and after manually upgrading numpy to the lates version, I get the same as @keunwoocho in the post directly above this one.

@Milesld
Copy link

Milesld commented Mar 15, 2022

Same error in chord transcription:
NotImplementedError: Cannot convert a symbolic Tensor (chord_model/encoder/strided_slice_1:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported.
Have anybody solved that?
@keunwoochoi @gergol

@bgenchel
Copy link

I am getting this error on linux (5.15.0-1016-gcp)

@yoyolicoris yoyolicoris added the bug Something isn't working label Mar 29, 2023
@jech2
Copy link

jech2 commented May 4, 2024

I got same error of 'ImportError: numpy.core.multiarray failed to import' while trying the chord transcription algorithm, even though I upgraded the numpy version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants