okio-ai / nendo

The Nendo AI Audio Tool Suite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError with 'TensorflowPredictEffnetDiscogs' in nendo_plugin_classify_core

filip-franek opened this issue · comments

Hi, I am trying to run Nendo Classifier in a container configured with this Dockerfile:

FROM debian:bullseye

# Install dependencies
RUN apt-get update && apt-get install -y \
    ffmpeg \
    libsndfile1 \
    portaudio19-dev \
    python3 \
    python3-pip

RUN pip3 install \
         nendo==0.1.3 \
         nendo-plugin-classify-core

Then I build and run it interactively on Ubuntu 23.10:

docker build -t nendo-app .
docker run -it --rm --name nendo-app nendo-app /bin/bash

When running this code in Python:

from nendo import Nendo, NendoConfig
nd = Nendo(config = NendoConfig(plugins=["nendo_plugin_classify_core"], log_level="info"))

I get:

[   INFO   ] MusicExtractorSVM: no classifier models were configured by default
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/nendo/main.py", line 73, in __init__
    self._load_plugins(plugin_names=plugin_names)
  File "/usr/local/lib/python3.9/dist-packages/nendo/main.py", line 141, in _load_plugins
    plugin_instance = self._load_plugin(module_name=module_name)
  File "/usr/local/lib/python3.9/dist-packages/nendo/main.py", line 129, in _load_plugin
    raise schema.NendoPluginLoadingError(
nendo.schema.exception.NendoPluginLoadingError: Failed to import plugin 'nendo_plugin_classify_core'. Error: module 'essentia.standard' has no attribute 'TensorflowPredictEffnetDiscogs'

The Python packages seems to be up-to-date

pip3 list | grep -E "nendo|essentia"
essentia                   2.1b6.dev1110
essentia-tensorflow        2.1b6.dev1110
nendo                      0.1.3
nendo-plugin-classify-core 0.2.1

Do you know how to debug this?

Hi @filip-franek

Thank you for reporting this issue.

I created a PR with a potential fix: okio-ai/nendo_plugin_classify_core#3. Once it passes review, a new version will be released immediately and your problem should be fixed from there on. Meanwhile, you can test it yourself if you want by replacing the following part in your Dockerfile:

RUN pip3 install \
         nendo==0.1.3 \
         nendo-plugin-classify-core

with

RUN pip3 install \
         nendo==0.1.3

RUN apt-get install -y git
RUN git clone --branch fix/import-error https://github.com/okio-ai/nendo_plugin_classify_core/
RUN pip3 install -e ./nendo_plugin_classify_core

Version 0.2.2 of the core classification plugin has been released. You can revert back to your original Dockerfile now. Please let us know whether it's all working smoothly now, so we can close this issue.

tried it out and still getting the same error despite the package being updated:

root@b2f0e4167362:/usr/src/app# python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from nendo import Nendo, NendoConfig
>>> nd = Nendo(config=NendoConfig(plugins=["nendo_plugin_classify_core"], log_level="info"))
[   INFO   ] MusicExtractorSVM: no classifier models were configured by default
100%|█████████████████████████████████████████████████| 18.4M/18.4M [00:18<00:00, 1.02MiB/s]
100%|█████████████████████████████████████████████████| 2.74M/2.74M [00:02<00:00, 1.35MiB/s]
100%|█████████████████████████████████████████████████| 2.06M/2.06M [00:01<00:00, 1.21MiB/s]
100%|██████████████████████████████████████████████████| 2.71M/2.71M [00:03<00:00, 686kiB/s]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/nendo/main.py", line 73, in __init__
    self._load_plugins(plugin_names=plugin_names)
  File "/usr/local/lib/python3.9/dist-packages/nendo/main.py", line 141, in _load_plugins
    plugin_instance = self._load_plugin(module_name=module_name)
  File "/usr/local/lib/python3.9/dist-packages/nendo/main.py", line 129, in _load_plugin
    raise schema.NendoPluginLoadingError(
nendo.schema.exception.NendoPluginLoadingError: Failed to import plugin 'nendo_plugin_classify_core'. Error: module 'essentia.standard' has no attribute 'TensorflowPredictEffnetDiscogs'

It does load something, but does not mention what. Have not noticed this part before, so I assume it appeared due to the fix?

root@b2f0e4167362:/usr/src/app# pip3 list | grep nendo
nendo                       0.1.3
nendo-plugin-classify-core  0.2.2

It seems the essentia.standard module does not even have the attribute TensorflowPredictEffnetDiscogs.

python3
>>> import essentia.standard as es
>>> 
>>> # Use dir() to list all the attributes of the essentia.standard module
>>> attributes = dir(es)
>>> 
>>> # Search for the attribute 'TensorflowPredictEffnetDiscogs'
>>> if 'TensorflowPredictEffnetDiscogs' in attributes:
...     print("TensorflowPredictEffnetDiscogs is present in essentia.standard")
... else:
...     print("TensorflowPredictEffnetDiscogs is NOT present in essentia.standard")
... 
TensorflowPredictEffnetDiscogs is NOT present in essentia.standard

>>> attributes
['AfterMaxToBeforeMaxEnergyRatio', 'AllPass', 'AudioLoader', 'AudioOnsetsMarker', 'AudioWriter', 'AutoCorrelation', 'BFCC', 'BPF', 'BandPass', 'BandReject', 'BarkBands', 'BeatTrackerDegara', 'BeatTrackerMultiFeature', 'Beatogram', 'BeatsLoudness', 'BinaryOperator', 'BinaryOperatorStream', 'BpmHistogram', 'BpmHistogramDescriptors', 'BpmRubato', 'CartesianToPolar', 'CentralMoments', 'Centroid', 'ChordsDescriptors', 'ChordsDetection', 'ChordsDetectionBeats', 'ChromaCrossSimilarity', 'Chromagram', 'Chromaprinter', 'ClickDetector', 'Clipper', 'ConstantQ', 'CoverSongSimilarity', 'Crest', 'CrossCorrelation', 'CrossSimilarityMatrix', 'CubicSpline', 'DCRemoval', 'DCT', 'Danceability', 'Decrease', 'Derivative', 'DerivativeSFX', 'DiscontinuityDetector', 'Dissonance', 'DistributionShape', 'Duration', 'DynamicComplexity', 'ERBBands', 'EasyLoader', 'EffectiveDuration', 'Energy', 'EnergyBand', 'EnergyBandRatio', 'Entropy', 'Envelope', 'EqloudLoader', 'EqualLoudness', 'Extractor', 'FFT', 'FFTC', 'FadeDetection', 'FalseStereoDetector', 'Flatness', 'FlatnessDB', 'FlatnessSFX', 'Flux', 'FrameCutter', 'FrameGenerator', 'FrameToReal', 'FreesoundExtractor', 'FrequencyBands', 'GFCC', 'GaiaTransform', 'GapsDetector', 'GeometricMean', 'HFC', 'HPCP', 'HarmonicBpm', 'HarmonicMask', 'HarmonicModelAnal', 'HarmonicPeaks', 'HighPass', 'HighResolutionFeatures', 'Histogram', 'HprModelAnal', 'HpsModelAnal', 'HumDetector', 'IDCT', 'IFFT', 'IFFTC', 'IIR', 'Inharmonicity', 'InstantPower', 'Intensity', 'Key', 'KeyExtractor', 'LPC', 'Larm', 'Leq', 'LevelExtractor', 'LogAttackTime', 'LogSpectrum', 'LoopBpmConfidence', 'LoopBpmEstimator', 'Loudness', 'LoudnessEBUR128', 'LoudnessVickers', 'LowLevelSpectralEqloudExtractor', 'LowLevelSpectralExtractor', 'LowPass', 'MFCC', 'Magnitude', 'MaxFilter', 'MaxMagFreq', 'MaxToTotal', 'Mean', 'Median', 'MedianFilter', 'MelBands', 'MetadataReader', 'Meter', 'MinMax', 'MinToTotal', 'MonoLoader', 'MonoMixer', 'MonoWriter', 'MovingAverage', 'MultiPitchKlapuri', 'MultiPitchMelodia', 'Multiplexer', 'MusicExtractor', 'MusicExtractorSVM', 'NNLSChroma', 'NSGConstantQ', 'NSGIConstantQ', 'NoiseAdder', 'NoiseBurstDetector', 'NoveltyCurve', 'NoveltyCurveFixedBpmEstimator', 'OddToEvenHarmonicEnergyRatio', 'OnsetDetection', 'OnsetDetectionGlobal', 'OnsetRate', 'Onsets', 'OverlapAdd', 'PCA', 'Panning', 'PeakDetection', 'PercivalBpmEstimator', 'PercivalEnhanceHarmonics', 'PercivalEvaluatePulseTrains', 'PitchContourSegmentation', 'PitchContours', 'PitchContoursMelody', 'PitchContoursMonoMelody', 'PitchContoursMultiMelody', 'PitchFilter', 'PitchMelodia', 'PitchSalience', 'PitchSalienceFunction', 'PitchSalienceFunctionPeaks', 'PitchYin', 'PitchYinFFT', 'PitchYinProbabilistic', 'PitchYinProbabilities', 'PitchYinProbabilitiesHMM', 'PolarToCartesian', 'PoolAggregator', 'PowerMean', 'PowerSpectrum', 'PredominantPitchMelodia', 'RMS', 'RawMoments', 'ReplayGain', 'Resample', 'ResampleFFT', 'RhythmDescriptors', 'RhythmExtractor', 'RhythmExtractor2013', 'RhythmTransform', 'RollOff', 'SBic', 'SNR', 'SaturationDetector', 'Scale', 'SilenceRate', 'SineModelAnal', 'SineModelSynth', 'SineSubtraction', 'SingleBeatLoudness', 'SingleGaussian', 'Slicer', 'SpectralCentroidTime', 'SpectralComplexity', 'SpectralContrast', 'SpectralPeaks', 'SpectralWhitening', 'Spectrum', 'SpectrumCQ', 'SpectrumToCent', 'Spline', 'SprModelAnal', 'SprModelSynth', 'SpsModelAnal', 'SpsModelSynth', 'StartStopCut', 'StartStopSilence', 'StereoDemuxer', 'StereoMuxer', 'StereoTrimmer', 'StochasticModelAnal', 'StochasticModelSynth', 'StrongDecay', 'StrongPeak', 'SuperFluxExtractor', 'SuperFluxNovelty', 'SuperFluxPeaks', 'TCToTotal', 'TempoScaleBands', 'TempoTap', 'TempoTapDegara', 'TempoTapMaxAgreement', 'TempoTapTicks', 'TensorNormalize', 'TensorTranspose', 'TensorflowInputFSDSINet', 'TensorflowInputMusiCNN', 'TensorflowInputTempoCNN', 'TensorflowInputVGGish', 'TonalExtractor', 'TonicIndianArtMusic', 'TriangularBands', 'TriangularBarkBands', 'Trimmer', 'Tristimulus', 'TruePeakDetector', 'TuningFrequency', 'TuningFrequencyExtractor', 'UnaryOperator', 'UnaryOperatorStream', 'Variance', 'Vibrato', 'Viterbi', 'WarpedAutoCorrelation', 'Welch', 'Windowing', 'YamlInput', 'YamlOutput', 'ZeroCrossingRate', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_c', '_create_essentia_class', '_create_python_algorithms', '_essentia', '_reloadAlgorithms', '_sys', 'algorithmInfo', 'algorithmNames', 'copy', 'essentia', 'iteritems']

>>> essentia.__version__
'2.1-beta6-dev'
>>> import nendo
>>> nendo.__version__
'0.1.3'

I am not familiar with essentia, but if I can be of any help to resolve this, please let me know. I have some experience with CI/CD pipelines if it comes in handy.

Thank you for your patience. Turns out there is an issue with essentia, where only one of essentia or essentia-tensorflow can be installed at a time. Just released a new version with the fix.

awesome, I ended up with this Dockerfile and it worked great.

FROM debian:bullseye

RUN apt-get update && apt-get install -y \
    ffmpeg \
    libsndfile1 \
    portaudio19-dev \
    python3 \
    python3-pip

RUN pip3 install nendo==0.1.3 \
                 nendo_plugin_classify_core==0.2.4
pip3 list | grep -E "nendo|tensorflow|essentia"
essentia-tensorflow        2.1b6.dev1110
nendo                      0.1.3
nendo-plugin-classify-core 0.2.4

Many thanks @faradox