Skip to content

Updates for Pytorch 2.7 #8429

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

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Updates for Pytorch 2.7 #8429

wants to merge 3 commits into from

Conversation

ericspod
Copy link
Member

Description

This will update MONAI to be compatible with PyTorch 2.7. There appear to be few code changes with this release so hopefully this will be simply a matter of updating versions.

Types of changes

  • 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>
@ericspod ericspod requested review from Copilot, Nic-Ma and KumoLiu April 25, 2025 11:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates MONAI’s torch dependency to a newer version aiming for improved compatibility with PyTorch. The changes include:

  • Increasing the minimum torch version in pyproject.toml from 2.3.0 to 2.4.1.
  • Updating the installation command in the GitHub Actions workflow (pythonapp.yml) accordingly.
  • Modifying the torch version matrix in the minimal workflow (pythonapp-min.yml).

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 3 comments.

File Description
pyproject.toml Updated minimum torch dependency and Black target versions
.github/workflows/pythonapp.yml Updated torch installation command to new dependency
.github/workflows/pythonapp-min.yml Revised torch version matrix for testing
Files not reviewed (2)
  • docs/requirements.txt: Language not supported
  • setup.cfg: Language not supported

Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
Signed-off-by: Eric Kerfoot <eric.kerfoot@kcl.ac.uk>
@ericspod
Copy link
Member Author

It's possible the CPU provided by the Windows runner is too old for PyTorch 2.7 which may now require instructions it doesn't have.

@ericspod
Copy link
Member Author

The issue with Windows appears to be related to float 64 calculations, specifically with RandRotate in tests\integration\test_pad_collation.py. This doesn't appear to be pad collation related and goes away if float 32 is used as the dtype. I'm investigating further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants