-
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
Bump torch minimum to mitigate CVE-2024-31580 & CVE-2024-31583 and enable numpy 2 compatibility #8368
Conversation
This bumps the minimum required `torch` version from 1.13.1 to 2.2.0. See GHSA-5pcm-hx3q-hm94 and GHSA-pg7h-5qx3-wjr3 for more details regarding the "High" severity scoring. - https://nvd.nist.gov/vuln/detail/CVE-2024-31580 - https://nvd.nist.gov/vuln/detail/CVE-2024-31583 Signed-off-by: James Butler <[email protected]>
832339d
to
6562140
Compare
Hi @jamesobutler thanks for the follow-up work on bumping versions. I have tried to get as much working with Numpy2 here without success on older Pytorch versions as expected. We should merge this PR first and then I can make sure Pytorch 2.6 is working there. We've agreed that this version bump should be done so we'll sort the last issues and merge. I don't know quite what to say about the macOS fails, it looks like precision is just slightly off so perhaps a more forgiving threshold in the assert statements is all we need. |
PyTorch added support for numpy 2 starting with PyTorch 2.3.0. This allows for numpy 1 or numpy 2 to be used with torch>=2.3.0. A special case is being handled on Windows as PyTorch Windows binaries had compatibilities issues with numpy 2 that were fixed in torch 2.4.1 (see pytorch/pytorch#131668 (comment)). Signed-off-by: James Butler <[email protected]>
6562140
to
f4def86
Compare
/build |
Thanks @jamesobutler for the PR, overall looks good to me. Thanks again. |
@KumoLiu, did the blossom-ci run for you? I see it listed as failed and I don't see results at https://github.com/Project-MONAI/MONAI/actions/runs/13547599286. |
Hi @jamesobutler, could you please add some check for this error? And I just removed the pytorch 2.2.2 support in the blossom pipline, if you could resolve the issue above I can help retrigger the blossom. Thanks again! |
This may have comes with the numpy 2 change where the precision of scalars is now preserved consistently. See https://numpy.org/devdocs/numpy_2_0_migration_guide.html#changes-to-numpy-data-type-promotion Observed testing results which failed only on the macOS runner: Mismatched elements: 1 / 1 (100%) Max absolute difference among violations: 2.74195588e-09 Max relative difference among violations: 3.36410326e-09 ACTUAL: array([0.815063], dtype=float32) DESIRED: array(0.815063) Signed-off-by: James Butler <[email protected]>
c0cfba6
to
9b6f622
Compare
/build |
For integration I recommend proceeding with the "Rebase and merge" option to integrate the 3 individual commits here to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks! We have always used squash-and-merge as the merge strategy to keep the commit logs clean and reduce clutter for the generated release notes. Other PRs which combined changed have been merged in this way without being a major source of confusion. If you're ok with this we can merge that way now.
These commits are organized nicely without a bunch of fix-me-up type commits (and has no merge commits). For git blaming purposes it is nice to have this PR's code diff organized into different commits such as knowing why we switched to |
Hi @jamesobutler I've discussed with our core team and we don't think a rebase is a good idea. In Atlassian's documentation they mention that one shouldn't ever rebase on a public branch. I realise Github's behaviour differs from regular git in that it rewrites commits. Rebasing is perhaps fine in this case but we want to avoid any unintended side-effects here and stick to our existing workflow which we know works. |
Hi @ericspod, what Atlassian is describing is to not do rebasing of a public branch like |
Hi @jamesobutler We're going to go ahead with a squash merge, we'll be fine with a number of changes in one commit but we'll take the advice on board, thanks. Also thanks again for this work, it's great to have things updated and a clearer idea for ourselves what our legacy dependency policy should be. |
Ok. Yeah with the combined commit of 2e391c8 we have lost the information provided in the commit message body of the |
This is a follow-up to the comments made in #8296 (comment).
Description
This bumps the minimum required
torch
version from 1.13.1 to 2.2.0 in the first commit.See GHSA-5pcm-hx3q-hm94 and GHSA-pg7h-5qx3-wjr3 for more details regarding the "High" severity scoring.
Additionally, PyTorch added support for numpy 2 starting with PyTorch 2.3.0. The second commit in this PR allows for numpy 1 or numpy 2 to be used with torch>=2.3.0. I have included this commit in this PR as upgrading to torch 2.2 means you might as well update to 2.3 to get the numpy 2 compatibility.
A special case is being handled on Windows as PyTorch Windows binaries had compatibilities issues with numpy 2 that were fixed in torch 2.4.1 (see pytorch/pytorch#131668 (comment)).
Maintainers will need to update the required status checks for the
dev
branch to:Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.