Skip to content
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

Use base version when comparing torch versions #16657

Merged
merged 11 commits into from
Mar 7, 2023

Conversation

awaelchli
Copy link
Contributor

@awaelchli awaelchli commented Feb 6, 2023

What does this PR do?

Fixes #16644

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

I made sure I had fun coding 🙃

cc @Borda @tchaton @carmocca @justusschock @awaelchli

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Feb 6, 2023
@awaelchli awaelchli added bug Something isn't working priority: 0 High priority task and removed pl Generic label for PyTorch Lightning package labels Feb 6, 2023
@awaelchli awaelchli added this to the v1.9.x milestone Feb 6, 2023
@github-actions github-actions bot added fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package labels Feb 6, 2023
@awaelchli awaelchli marked this pull request as ready for review February 6, 2023 21:36
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2023

⚡ Required checks status: All passing 🟢

Groups summary

🟢 pytorch_lightning: Tests workflow
Check ID Status
pl-cpu (macOS-11, lightning, 3.8, 1.11) success
pl-cpu (macOS-11, lightning, 3.9, 1.12) success
pl-cpu (macOS-11, lightning, 3.10, 1.13) success
pl-cpu (macOS-11, lightning, 3.8, 1.11, oldest) success
pl-cpu (macOS-11, lightning, 3.9, 2.0, pre) success
pl-cpu (ubuntu-20.04, lightning, 3.9, 1.11) success
pl-cpu (ubuntu-20.04, lightning, 3.10, 1.12) success
pl-cpu (ubuntu-20.04, lightning, 3.10, 1.13) success
pl-cpu (ubuntu-20.04, lightning, 3.8, 1.11, oldest) success
pl-cpu (ubuntu-20.04, lightning, 3.9, 2.0, pre) success
pl-cpu (windows-2022, lightning, 3.9, 1.11) success
pl-cpu (windows-2022, lightning, 3.10, 1.12) success
pl-cpu (windows-2022, lightning, 3.10, 1.13) success
pl-cpu (windows-2022, lightning, 3.8, 1.11, oldest) success
pl-cpu (windows-2022, lightning, 3.9, 2.0, pre) success
pl-cpu (macOS-11, pytorch, 3.8, 1.13) success
pl-cpu (ubuntu-20.04, pytorch, 3.8, 1.13) success
pl-cpu (windows-2022, pytorch, 3.8, 1.13) success

These checks are required after the changes to src/lightning/fabric/utilities/imports.py, src/lightning/pytorch/utilities/imports.py.

🟢 pytorch_lightning: Azure GPU
Check ID Status
pytorch-lightning (GPUs) success

These checks are required after the changes to src/lightning/pytorch/utilities/imports.py, src/lightning/fabric/utilities/imports.py.

🟢 pytorch_lightning: Azure HPU
Check ID Status
pytorch-lightning (HPUs) success

These checks are required after the changes to src/lightning/fabric/utilities/imports.py, src/lightning/pytorch/utilities/imports.py.

🟢 fabric: Docs
Check ID Status
make-doctest (fabric) success
make-html (fabric) success

These checks are required after the changes to src/lightning/fabric/utilities/imports.py.

🟢 pytorch_lightning: Docs
Check ID Status
make-doctest (pytorch) success
make-html (pytorch) success

These checks are required after the changes to src/lightning/pytorch/utilities/imports.py.

🟢 lightning_fabric: CPU workflow
Check ID Status
fabric-cpu (macOS-11, lightning, 3.8, 1.11) success
fabric-cpu (macOS-11, lightning, 3.9, 1.12) success
fabric-cpu (macOS-11, lightning, 3.10, 1.13) success
fabric-cpu (macOS-11, lightning, 3.8, 1.11, oldest) success
fabric-cpu (macOS-11, lightning, 3.9, 2.0, pre) success
fabric-cpu (ubuntu-20.04, lightning, 3.9, 1.11) success
fabric-cpu (ubuntu-20.04, lightning, 3.10, 1.12) success
fabric-cpu (ubuntu-20.04, lightning, 3.10, 1.13) success
fabric-cpu (ubuntu-20.04, lightning, 3.8, 1.11, oldest) success
fabric-cpu (ubuntu-20.04, lightning, 3.9, 2.0, pre) success
fabric-cpu (windows-2022, lightning, 3.9, 1.11) success
fabric-cpu (windows-2022, lightning, 3.10, 1.12) success
fabric-cpu (windows-2022, lightning, 3.10, 1.13) success
fabric-cpu (windows-2022, lightning, 3.8, 1.11, oldest) success
fabric-cpu (windows-2022, lightning, 3.9, 2.0, pre) success
fabric-cpu (macOS-11, fabric, 3.8, 1.13) success
fabric-cpu (ubuntu-20.04, fabric, 3.8, 1.13) success
fabric-cpu (windows-2022, fabric, 3.8, 1.13) success

These checks are required after the changes to src/lightning/fabric/utilities/imports.py.

🟢 lightning_fabric: Azure GPU
Check ID Status
lightning-fabric (GPUs) success

These checks are required after the changes to src/lightning/fabric/utilities/imports.py.

🟢 mypy
Check ID Status
mypy success

These checks are required after the changes to src/lightning/fabric/utilities/imports.py, src/lightning/pytorch/utilities/imports.py.

🟢 install
Check ID Status
install-pkg (ubuntu-22.04, app, 3.8) success
install-pkg (ubuntu-22.04, app, 3.10) success
install-pkg (ubuntu-22.04, fabric, 3.8) success
install-pkg (ubuntu-22.04, fabric, 3.10) success
install-pkg (ubuntu-22.04, pytorch, 3.8) success
install-pkg (ubuntu-22.04, pytorch, 3.10) success
install-pkg (ubuntu-22.04, lightning, 3.8) success
install-pkg (ubuntu-22.04, lightning, 3.10) success
install-pkg (ubuntu-22.04, notset, 3.8) success
install-pkg (ubuntu-22.04, notset, 3.10) success
install-pkg (macOS-12, app, 3.8) success
install-pkg (macOS-12, app, 3.10) success
install-pkg (macOS-12, fabric, 3.8) success
install-pkg (macOS-12, fabric, 3.10) success
install-pkg (macOS-12, pytorch, 3.8) success
install-pkg (macOS-12, pytorch, 3.10) success
install-pkg (macOS-12, lightning, 3.8) success
install-pkg (macOS-12, lightning, 3.10) success
install-pkg (macOS-12, notset, 3.8) success
install-pkg (macOS-12, notset, 3.10) success
install-pkg (windows-2022, app, 3.8) success
install-pkg (windows-2022, app, 3.10) success
install-pkg (windows-2022, fabric, 3.8) success
install-pkg (windows-2022, fabric, 3.10) success
install-pkg (windows-2022, pytorch, 3.8) success
install-pkg (windows-2022, pytorch, 3.10) success
install-pkg (windows-2022, lightning, 3.8) success
install-pkg (windows-2022, lightning, 3.10) success
install-pkg (windows-2022, notset, 3.8) success
install-pkg (windows-2022, notset, 3.10) success

These checks are required after the changes to src/lightning/fabric/utilities/imports.py, src/lightning/pytorch/utilities/imports.py.

🟢 link-check
Check ID Status
markdown-link-check success

These checks are required after the changes to src/lightning/pytorch/CHANGELOG.md.


Thank you for your contribution! 💜

Note
This comment is automatically generated and updates for 60 minutes every 180 seconds. If you have any other questions, contact carmocca for help.

@awaelchli awaelchli self-assigned this Feb 6, 2023
_TORCH_GREATER_EQUAL_1_12 = compare_version("torch", operator.ge, "1.12.0")
_TORCH_GREATER_EQUAL_1_13 = compare_version("torch", operator.ge, "1.13.0")
_TORCH_GREATER_EQUAL_1_12 = compare_version("torch", operator.ge, "1.12.0", use_base_version=True)
_TORCH_GREATER_EQUAL_1_13 = compare_version("torch", operator.ge, "1.13.0", use_base_version=True)
Copy link
Contributor

@carmocca carmocca Feb 6, 2023

Choose a reason for hiding this comment

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

This change allows a different bug:

If we use an api added in 1.13.0 (final release)
But the user has 1.13.0+a
Where 1.13.0+a is an earlier version that doesnt include this api
There will be an error

Copy link
Contributor

@carmocca carmocca Feb 6, 2023

Choose a reason for hiding this comment

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

So I suggest that we don't do this and we just recommend upgrading torch instead. Meaning we don't support old nightly or pre-release versions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The user in the linked issue is using a standard docker image from nvidia: nvcr.io/nvidia/pytorch:22.10-py3
This means we won't support any of these?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess. I wonder why they use these PyTorch installations. One improvement we could do would be to warn the user about this.

Copy link

Choose a reason for hiding this comment

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

I am using these images for the sake of repeatability in my experiments and because all the packages are
working out of the box (no need to manage conda/pip requirements, just run docker run nvcr.io/nvidia/pytorch:22.10-py3 python my_script.py).

Copy link
Member

Choose a reason for hiding this comment

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

As this is related to officila Nvidia/PyTorch images, I would roll this change with use_base_version

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a comment above the changed lines with an explanation for the issue with a reference to this PR

Copy link
Contributor

@carmocca carmocca Mar 9, 2023

Choose a reason for hiding this comment

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

@awaelchli This introduced a failing workflow in master (build-NGC) exactly because of this issue. The NGC 1.13 image installs a 1.13 release (1.13.0a0+d0d6b1f) that doesn't include a feature included in the true 1.13 release:

https://github.com/Lightning-AI/lightning/actions/runs/4358626506/jobs/7619447910#step:3:1685

This will fail for anybody installing this specific image. I don't have any better suggestion than reverting this PR or skipping the workflow.

Copy link
Contributor Author

@awaelchli awaelchli Mar 10, 2023

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure. This method will go away in future releases anyways

@codecov
Copy link

codecov bot commented Feb 6, 2023

Codecov Report

Merging #16657 (10ea001) into master (da572d7) will decrease coverage by 22%.
The diff coverage is 100%.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #16657     +/-   ##
=========================================
- Coverage      82%      59%    -22%     
=========================================
  Files         439      414     -25     
  Lines       31763    31463    -300     
=========================================
- Hits        25968    18670   -7298     
- Misses       5795    12793   +6998     

@mergify mergify bot added the has conflicts label Feb 7, 2023
@awaelchli awaelchli marked this pull request as draft February 8, 2023 13:29
@awaelchli awaelchli marked this pull request as ready for review March 3, 2023 15:11
@mergify mergify bot removed the has conflicts label Mar 3, 2023
Copy link
Contributor

@carmocca carmocca left a comment

Choose a reason for hiding this comment

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

Approving to unblock

src/lightning/pytorch/utilities/imports.py Outdated Show resolved Hide resolved
@mergify mergify bot added the ready PRs ready to be merged label Mar 6, 2023
@awaelchli awaelchli enabled auto-merge (squash) March 6, 2023 20:42
@awaelchli awaelchli merged commit 63b9034 into master Mar 7, 2023
@awaelchli awaelchli deleted the bugfix/torch-version-comparision branch March 7, 2023 21:15
awaelchli added a commit that referenced this pull request Mar 7, 2023
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
awaelchli added a commit that referenced this pull request Mar 9, 2023
Borda pushed a commit that referenced this pull request Mar 30, 2023
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

(cherry picked from commit 63b9034)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package priority: 0 High priority task ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: cannot create weak reference to 'weakcallableproxy' object after upgrading to 1.9.0
4 participants