Incompatible with numpy>2.0
The function _convert_samples_to_float32 in NeMo/nemo/collections/asr/parts/preprocessing/segment.py is not compatible with numpy>2.0
Consider changing to:
def _convert_samples_to_float32(samples):
"""Convert sample type to float32.
Audio sample type is usually integer or float-point.
Integers will be scaled to [-1, 1] in float32.
"""
float32_samples = samples.astype('float32')
if np.issubdtype(samples.dtype, np.integer):
bits = np.iinfo(samples.dtype).bits
float32_samples *= 1.0 / 2 ** (bits - 1)
elif np.issubdtype(samples.dtype, np.floating):
pass
else:
raise TypeError("Unsupported sample type: %s." % samples.dtype)
return float32_samples
Faced the same issue. Awaiting fix.
There's already a PR (#11447) for supporting numpy>2 but there hasn't been any response from the ASR maintainers.
@julius-richter, I am the author of the aforementioned PR from @JanetVictorious. However, I've been trying for weeks to get a review for it from the Nvidia folks with no luck. For what's worth, and if it helps - you can use my branch temporarily as it has the fixes baked in.
It'd be really great to merge this as I'd like to contribute more... However, given the lack of responses my motivation is not exactly high if its bound to receive the "silent" treatment.
(edit: the only reason that it's closed is that there was no activity for 7 days, but I got tired of posting and pinging people to keep it alive)
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
@nithinraok I have already created a PR (https://github.com/NVIDIA/NeMo/pull/11447) for this... therefore all @monica-sekoyan has to do is just provide a review...
Hi @andylamp . Thank you for the help.
Unfortunately we found multiple dependencies like tensorrt-llm , thinc, lightning-thunder still requires numpy<2,>=1.23.0.
@ko3n1g FYI
@nithinraok thanks for the visibility and the interaction - it really was a long time since I received an official reply on this.
As a question, is that the entire list of packages that have a dependency with numpy<2? If so, can I help you in upgrading/replacing the said dependencies so we can finally resolve the compatibility issue?
As far I noticed that should be it. @ko3n1g could you please confirm.
Alright @nithinraok , that's cool. After looking a bit at the compatibility of recent versions of these packages with numpy>=2.0:
tensorrt-llm: I do not see any issues that show incompatibility withnumpy>=2.0... but on requirements there is a hard pin fornumpyversions < 2. Therefore, am not sure how this can easily be fixed without updating that library on Nvidia's side.thinc: incompatibility seems to be resolved in recent versions as of here.lightning-thunder: seems to be compatible in recent versions (see here).
The only blocker seems to be the Nvidia tensorrt-llm library.
However, if you take a look at the PR (#11447) it addresses the numpy incompatibility by using a backwards compatible method -- i.e. it works with both 1.x and 2.x numpy versions. Therefore, I do not see a reason why this could not be merged... Do you think that'll be possible? I am asking since that fix will help those who use bits of NeMo that don't require the above libraries but want to use numpy>=2 (e.g. ASR).
Thanks @andylamp for your help with this!
We're working on upgrading all NeMo collections to NumPy 2.0 via this draft PR: https://github.com/NVIDIA/NeMo/pull/12868. This approach is safer than updating each collection individually, like ASR.
That said, your PR updating the ASR signatures should work for those who want to use NumPy 2.0 with ASR specifically.
I've opened an issue to track the TRT-LLM update for NumPy >2.0. In the meantime, I’ve approved your PR — let’s wait for CI to pass before merging.
Thanks again!
@nithinraok thanks a lot! Yeah, this is a quick win that can help those that do not use these dependencies. It would be great to eventually iron out any kinks and get numpy>=2.0 compatible with the entire NeMo suite.
Hey. Thanks for the thread above.
What is the current status on this? numpy >= 2 is a common dependency.
General requirements is updated on main now. So next pip installable will have numpy >2
@ko3n1g I see https://github.com/NVIDIA/NeMo/blob/f652c583c85a3b909725d010cb15a8a040403e92/requirements/requirements_nlp.txt#L14 need to be updated @thomasdhc FYI
Amazing! Thanks @nithinraok @thomasdhc.
Do you guys have a target date for the release? Some things at work that would benefit from having @latest
If you are executing ASR pathways please pip install from source using: pip install -e ".[asr]"
This will install all packages needed for the ASR pathway and excludes NLP requirements.
Numpy restrictions for NLP module is being tested separately.
@ArthurBook
Amazing! Thanks @nithinraok @thomasdhc. Do you guys have a target date for the release? Some things at work that would benefit from having
@latest
We'd target for our next major release which is roughly every two months.
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been inactive for 7 days since being marked as stale.