litgpt icon indicating copy to clipboard operation
litgpt copied to clipboard

numpy 2.0.0 support

Open cardoprimo opened this issue 1 year ago • 4 comments

I ran pip install 'litgpt[all]' which I suppose has numpy latest as dep. Numpy 2.0.0 has just been released. So I'm getting the error below whilst trying litgpt download list. For now, forced downgrade - pip install --upgrade numpy==1.26.4 - removed the error.

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

cardoprimo avatar Jun 16 '24 19:06 cardoprimo

Thanks for the note. I'll pin numpy==1.26.4 for now and then investigate further regarding the changes in the NumPy 2.0 release this week.

rasbt avatar Jun 16 '24 19:06 rasbt

https://stackoverflow.com/questions/78641150/a-module-that-was-compiled-using-numpy-1-x-cannot-be-run-in-numpy-2-0-0-as-it-ma/78641405?noredirect=1#comment138648878_78641405

RubTalha avatar Jun 19 '24 09:06 RubTalha

I did a quick test and it looks like it's better to stick to an older version of numpy for some time (a month maybe?). While the latest version of torch (2.3.1) supports numpy 2.0, not all other dependencies can state the same. For instance tensorboard can throw this error:

AttributeError: np.string_ was removed in the NumPy 2.0 release. Use np.bytes_ instead.. Did you mean: 'strings'?

In addition, other Lightning dependencies like Thunder also pinned to an older version of numpy.

So let's revisit the issue somewhere in July.

Andrei-Aksionov avatar Jun 19 '24 11:06 Andrei-Aksionov

I can echo this and would say let's wait at least a month before we revisit this to give all the dependencies time to catch up.

rasbt avatar Jun 19 '24 11:06 rasbt