Skip to content

AttributeError: module 'numpy.random' has no attribute 'integers'#182

Description

@abePclWaseda

馃悰 Bug

src/laion_clap/training/data.py still calls np.random.integers, which does not exist in the top-level NumPy API. This causes an AttributeError when running model.get_audio_embedding_from_filelist().

https://github.com/LAION-AI/CLAP/blob/main/src/laion_clap/training/data.py#L467

overflow = len(audio_data) - max_len
idx = np.random.integers(0, overflow + 1)   # 馃毃 AttributeError

I'm using NumPy 1.26.4.
Is there a recommended fix or workaround for this?

Work-around

import numpy as np
if not hasattr(np.random, "integers"):
    np.random.integers = np.random.randint

import laion_clap

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions