New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NumPy 2.0 Support #107302
Comments
cc @atalman, @osalpekar |
IMO we should do some of that for 2.3 (already started by making PyTorch compilable against Numpy-2.0) |
I agree. It is important to build all binaries for the next minor or bugfix release of PyTorch against the latest NumPy 2.0.0 pre-release. That way, it will be ABI-compatible with both 1.x and 2.0, which is going to avoid a lot of problems. If such a release is not done before numpy 2.0.0 final is out (probably 8 weeks from now), then any environments created with The plan posted by @albanD in the issue description still looks right. The first item is probably no longer relevant, since |
Note that we still support 3.8+ in PyTorch. So only the version of CPython for which Numpy 2.0 will be released need to be updated. Based on the versions available for the beta, I guess we will need to change the 3.9+ builds of PyTorch only. I think we should:
@atalman I can take care of 1 today, would someone on the Release/Infra team be able to work on 2 and 3 so that we can get this done for the next RC? |
Note that numpy |
Thanks for the info Ralf! |
@albanD : Binaries should be supporting rc1 for both wheels and conda packages now, since this PR is landed: pytorch/builder#1768 will be cherry-picking this into release and generating an rc |
Bump numpy version to 2.0.0rc1 in CI Related to: #107302 Pull Request resolved: #123286 Approved by: https://github.com/huydhn, https://github.com/kit1980, https://github.com/ZainRizvi
Bump numpy version to 2.0.0rc1 in CI Related to: #107302 Pull Request resolved: #123286 Approved by: https://github.com/huydhn, https://github.com/kit1980, https://github.com/ZainRizvi (cherry picked from commit 26b4ccf)
Bump numpy version to 2.0.0rc1 in CI Related to: #107302 Pull Request resolved: #123286 Approved by: https://github.com/huydhn, https://github.com/kit1980, https://github.com/ZainRizvi (cherry picked from commit 26b4ccf)
Bump numpy version to 2.0.0rc1 in CI Related to: #107302 Pull Request resolved: #123286 Approved by: https://github.com/huydhn, https://github.com/kit1980, https://github.com/ZainRizvi (cherry picked from commit 26b4ccf) Co-authored-by: atalman <atalman@fb.com>
Tested the RC from https://dev-discuss.pytorch.org/t/pytorch-release-2-3-0-final-rc-is-available/1995 with both the 2.0 and 1.26 versions and everything is working smoothly. |
Thanks for all of your work here! 🙏
Would it be possible to move the NumPy Conda packages to a different label (like Currently users are picking them up unintentionally when installing from the Edit: To clarify the NumPy RC packages (not PyTorch's own packages) are what users are picking up |
@jakirkham removed numpy from pytorch and pytorch-conda conda channel. Thank you for reporting this issue. |
Validated pytorch 2.3.0 from |
Thanks @atalman! 🙏 Please feel free to close issue: pytorch/builder#1776 Also thanks for all your and the teams work on NumPy 2 support Sounds good |
Bump numpy version to 2.0.0rc1 in CI Related to: pytorch#107302 Pull Request resolved: pytorch#123286 Approved by: https://github.com/huydhn, https://github.com/kit1980, https://github.com/ZainRizvi
NumPy 2.0 is expected to be out in December 2023. See details at numpy/numpy#24300
The major changes are going to be some Python API and behavior improvements. These don't impact PyTorch code itself and our compat layer (https://github.com/pytorch/pytorch/tree/main/torch/_numpy) is targeting 2.0+ already.
There are also C-API changes and in particular while 2.0 ABI will be backward compatible, the current ABI will not be forward compatible with 2.0. This will require some care on our end to make sure things work properly.
In terms of PyTorch future release, it means that, as of today, the expected support matrix looks like:
.numpy()
and.from_numpy()
functions will ONLY work if the version of NumPy installed is <2.0. Users can build from source against their version of NumPy if they need a more recent version of NumPy.The AIs to ensure this works:
torch.compile
compatible with NumPy 2.0. In order to do that, we may need to update thetest/torch_np
tests that we pulled from NumPycc @mruberry @rgommers
The text was updated successfully, but these errors were encountered: