-
Notifications
You must be signed in to change notification settings - Fork 587
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
Fix torch.compile
on nn.module
instead of on LightningModule
#587
Conversation
Tests can be fixed by merging this PR #585 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #587 +/- ##
==========================================
+ Coverage 83.75% 84.03% +0.28%
==========================================
Files 11 11
Lines 357 357
==========================================
+ Hits 299 300 +1
+ Misses 58 57 -1
☔ View full report in Codecov by Sentry. |
@@ -21,6 +21,7 @@ channels: | |||
# compatibility is usually guaranteed | |||
|
|||
dependencies: | |||
- python=3.10 |
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.
Is python 3.10 required for torch compile?
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.
Yeah, unfortunately
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.
Are you sure? I see here that only python 3.8 is required.
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.
I forget exactly the error I got, so I'll try to recreate it to show that 3.10 is required, for posterity's sake.
Thanks for PR, you can set it to ready if you want me to merge |
torch.compile
on nn.module
instead of on LightningModule
Revert this fix as it has been fixed in PyTorch? |
I noticed this recently as well. I'm currently testing it for myself. I'm not sure which version of PyTorch fixes this problem as I don't see a version mentioned in the comment Lightning-AI/pytorch-lightning#17177 (comment) but I'll try to find it. |
Alright, so I created a new conda environment with the following packages installed:
This was from the following # reasons you might want to use `environment.yaml` instead of `requirements.txt`:
# - pip installs packages in a loop, without ensuring dependencies across all packages
# are fulfilled simultaneously, but conda achieves proper dependency control across
# all packages
# - conda allows for installing packages without requiring certain compilers or
# libraries to be available in the system, since it installs precompiled binaries
name: lightning-hydra-template-py38
channels:
- pytorch
- nvidia
- conda-forge
- defaults
# it is strongly recommended to specify versions of packages installed through conda
# to avoid situation when version-unspecified packages install their latest major
# versions which can sometimes break things
# current approach below keeps the dependencies in the same major versions across all
# users, but allows for different minor and patch versions of packages where backwards
# compatibility is usually guaranteed
dependencies:
- pytorch=2.0.1
- pytorch-cuda=11.8
- torchvision=0.15
- lightning=2.0.7
- torchmetrics=1.1.2
- hydra-core=1.3
- rich=13.3
- pre-commit=3.3 # dev
- pytest=7.2 # dev
- pydantic=2.1 # dev, required by pytest
- python=3.8
# --------- loggers --------- #
# - wandb
# - neptune-client
# - mlflow
# - comet-ml
# - aim>=3.16.2 # no lower than 3.16.2, see https://github.com/aimhubio/aim/issues/2550
- pip>=23
- pip:
- hydra-colorlog==1.2.0
- rootutils==1.0.7 Then I ran
Finally, this is my environment info (using
This is with the setup where |
What does this PR do?
Related to this issue Lightning-AI/pytorch-lightning#17177.
Before submitting
pytest
command?pre-commit run -a
command?Did you have fun?
Make sure you had fun coding 🙃