AttributeError: module 'numpy.random' has no attribute 'integers'
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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