dmlc / treelite

Universal model exchange and serialization format for decision tree forests
https://treelite.readthedocs.io/en/latest/
Apache License 2.0
723 stars 98 forks source link

NumPy 2.0 support #560

Closed jakirkham closed 1 month ago

jakirkham commented 2 months ago

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 commented 2 months ago

cc @hcho3

seberg commented 2 months ago

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.

jameslamb commented 1 month ago

@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.

jakirkham commented 1 month ago

Looks like Philip gave you a +1

Would say go for it 🙂

Thanks James! 🙏