LAION-AI / LAION-AI/CLAP

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

Open
#182 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.3k
Forks
213
PR merge metrics
No merged PRs in 30d

Description

🐛 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open src/laion_clap/training/data.py around line 467 and trace the call from model.get_audio_embedding_from_filelist(). Verify the NumPy random API used there against NumPy 1.26.4, then exercise the audio embedding path to confirm the AttributeError is gone and the overflow offset behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
audio-video-rtc, machine-learning
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.