Skip to content

error when initializing the model #96

@sivannavis

Description

@sivannavis

Hi! I'm just following the tutorial doing these:

import openl3
model = openl3.models.load_audio_embedding_model(
    input_repr="mel128",
    content_type='music',
    embedding_size=512,
)

And an error pops out:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/ext3/miniconda3/lib/python3.11/site-packages/openl3/models.py", line 134, in load_audio_embedding_model
    return load_audio_embedding_model_from_path(model_path, input_repr, embedding_size, frontend=frontend)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ext3/miniconda3/lib/python3.11/site-packages/openl3/models.py", line 166, in load_audio_embedding_model_from_path
    m = AUDIO_MODELS[input_repr](include_frontend=frontend == 'kapre')
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ext3/miniconda3/lib/python3.11/site-packages/openl3/models.py", line 413, in _construct_mel128_audio_network
    spec = __fix_kapre_spec(get_melspectrogram_layer)(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ext3/miniconda3/lib/python3.11/site-packages/openl3/models.py", line 44, in get_spectrogram
    seq = func(*a, return_decibel=False, **kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ext3/miniconda3/lib/python3.11/site-packages/kapre/composed.py", line 261, in get_melspectrogram_layer
    return Sequential(layers, name=name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ext3/miniconda3/lib/python3.11/site-packages/keras/src/models/sequential.py", line 74, in __init__
    self._maybe_rebuild()
  File "/ext3/miniconda3/lib/python3.11/site-packages/keras/src/models/sequential.py", line 139, in _maybe_rebuild
    self.build(input_shape)
  File "/ext3/miniconda3/lib/python3.11/site-packages/keras/src/layers/layer.py", line 222, in build_wrapper
    original_build_method(*args, **kwargs)
  File "/ext3/miniconda3/lib/python3.11/site-packages/keras/src/models/sequential.py", line 180, in build
    x = layer(x)
        ^^^^^^^^
  File "/ext3/miniconda3/lib/python3.11/site-packages/keras/src/utils/traceback_utils.py", line 122, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/ext3/miniconda3/lib/python3.11/site-packages/optree/ops.py", line 594, in tree_map
    return treespec.unflatten(map(func, *flat_args))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Exception encountered when calling STFT.call().

Could not automatically infer the output shape / dtype of 'stft_3' (of type STFT). Either the `STFT.call()` method is incorrect, or you need to implement the `STFT.compute_output_spec() / compute_output_shape()` method. Error encountered:

Invalid dtype: complex64

Arguments received by STFT.call():
  • args=('<KerasTensor shape=(None, 1, 48000), dtype=float32, sparse=None, name=keras_tensor_7>',)
  • kwargs=<class 'inspect._empty'>

Any idea what I did wrong here? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions