-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 Behaviour Changes #7856
Comments
This was referenced Jun 17, 2024
Merged
The current temporary fix is to disable Numpy 2.0 in requirements.txt and then we'll work on compatibility fixes. There are other issues beyond the raised here in terms of deterministic behaviour and accuracy and seen in tests when run with Numpy 2.0 and some fixes I tried. |
ziw-liu
added a commit
to mehta-lab/VisCy
that referenced
this issue
Jul 18, 2024
mattersoflight
pushed a commit
to mehta-lab/VisCy
that referenced
this issue
Jul 19, 2024
rcremese
pushed a commit
to rcremese/MONAI
that referenced
this issue
Sep 2, 2024
Fixes Project-MONAI#7856. ### Description This introduces changes to meet Numpy 2.0 requirements. MONAI itself is compatible with Numpy 2.0 however some dependencies are not such as older versions of Pytorch. This PR adjusts the MAX_SEED value to be compatible with Numpy 2.0 behaviour changes, uses the `ptp` function, and some other minor tweaks. The versions for dependencies are also fixed to exclude Numpy 2.0. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk> Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Numpy 2.0 was just released with some behavioural changes which are showing up as bugs. One that is seen in this trace:
The underlying issue is that the
MAX_SEED
value is 2**32 which is an overflow value for uint32. It is stored as a Pythonint
but when used as the right hand side of modulus in this expression where_seed
is a uint32 of any value, the exception shown above is raised. In Numpy before 2.0, the expression would silently produce a int64 result.To Reproduce
Steps to reproduce the behavior:
np.uint32(1)%(np.iinfo(np.uint32).max+1)
Expected behavior
No exception should be raise for this operations if the MAX_SEED value is set correctly. The result from the expression should be a uint32.
Environment
Ensuring you use the relevant python executable, please paste the output of:
Additional context
This was encountered when doing a PR on the
gen-ai-dev
branch. @virginiafdezThe text was updated successfully, but these errors were encountered: