treelite icon indicating copy to clipboard operation
treelite copied to clipboard

NumPy 2.0 support

Open jakirkham opened this issue 10 months ago • 1 comments

NumPy 2.0 is coming out soon ( https://github.com/numpy/numpy/issues/24300 ). NumPy 2.0.0rc1 packages for conda & wheels came out 3 weeks back ( https://github.com/numpy/numpy/issues/24300#issuecomment-2030603395 )

To prepare for NumPy 2.0, it might be worthwhile to start testing against NumPy 2 in CI

NumPy has put out a migration guide. More details are in the release notes

If Treelite make use of NumPy's C API (and produces wheels that use it), having a release of Treelite with wheels built against NumPy 2.0.0rc1 would be helpful to ensure NumPy 1 & 2 compatible wheels (as wheels built against NumPy 1 won't be compatible with NumPy 2). More details in this NumPy 2 ABI doc

Also as NumPy is tracking ecosystem support for NumPy 2.0, it would be helpful to share Treelite current support status in issue (with any plans): https://github.com/numpy/numpy/issues/26191

jakirkham avatar Apr 24 '24 23:04 jakirkham

cc @hcho3

jakirkham avatar Apr 24 '24 23:04 jakirkham

I have checked locally, and the only change necessary to make the tests pass is to change copy=False calls to np.array() to instead call np.asarray() and remove the copy=False. The C-API is not used, so there is nothing to worry there but that Python change is very disruptive and requires a new release unfortunately.

seberg avatar May 08 '24 14:05 seberg

@seberg @hcho3 I'd be happy to make and test those changes if you'd like. I've been wanting to get a bit more familiar with treelite anyway.

jameslamb avatar May 15 '24 22:05 jameslamb

Looks like Philip gave you a +1

Would say go for it 🙂

Thanks James! 🙏

jakirkham avatar May 16 '24 05:05 jakirkham