Skip to content

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

@abePclWaseda

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

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