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

Fix issues with PL 1.8 #5353

Merged
merged 29 commits into from
Nov 28, 2022
Merged

Fix issues with PL 1.8 #5353

merged 29 commits into from
Nov 28, 2022

Conversation

SeanNaren
Copy link
Collaborator

What does this PR do ?

Attempts to fix all issues after many deprecations/lightning lite becoming the backbone for a lot of the underlying pytorch lightning code.

cc @titu1994

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

Signed-off-by: SeanNaren <[email protected]>
nemo/collections/tts/models/fastpitch.py Show resolved Hide resolved
nemo/core/config/hydra_runner.py Outdated Show resolved Hide resolved
nemo/utils/exp_manager.py Show resolved Hide resolved
Signed-off-by: SeanNaren <[email protected]>
@SeanNaren
Copy link
Collaborator Author

This PR should hopefully unblock the move to 1.8: Lightning-AI/pytorch-lightning#15737 (review)

We'll just wait till it gets into a minor release version (which hopefully would be tomorrow).

# Conflicts:
#	nemo/core/classes/exportable.py
Signed-off-by: SeanNaren <[email protected]>
Signed-off-by: SeanNaren <[email protected]>
Signed-off-by: SeanNaren <[email protected]>
Signed-off-by: SeanNaren <[email protected]>
Signed-off-by: SeanNaren <[email protected]>
Signed-off-by: SeanNaren <[email protected]>
Jenkinsfile Outdated Show resolved Hide resolved
Signed-off-by: SeanNaren <[email protected]>
@SeanNaren SeanNaren marked this pull request as ready for review November 23, 2022 21:00
Copy link
Collaborator

@titu1994 titu1994 left a comment

Choose a reason for hiding this comment

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

Overall, incredible work @SeanNaren ! Minor comments and needs one other reviewer since it's a core change

@@ -128,7 +129,7 @@ def _export(
# Set module mode
with torch.onnx.select_model_mode_for_export(
self, training
), torch.inference_mode(), torch.no_grad(), torch.jit.optimized_execution(True):
), torch.inference_mode(), torch.no_grad(), torch.jit.optimized_execution(True), _jit_is_scripting():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm we don't use lightning during export, is this method safe ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would the tests have confirmed if this is fine? The underlying code is simple to what is happening:

In Lightning:

@contextmanager
def _jit_is_scripting() -> Generator:
    """Workaround for https://github.com/pytorch/pytorch/issues/67146."""
    LightningModule._jit_is_scripting = True
    try:
        yield
    finally:
        LightningModule._jit_is_scripting = False

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm i dont think it would be caught in tests, lets keep it for now

tests/hydra/test_hydra_runner.py Outdated Show resolved Hide resolved
Signed-off-by: SeanNaren <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Nov 24, 2022

This pull request fixes 1 alert when merging d614378 into 2430d0f - view on LGTM.com

fixed alerts:

  • 1 for Unused import

Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog.

@titu1994 titu1994 merged commit d349f4a into main Nov 28, 2022
@titu1994 titu1994 deleted the feat/lightning_1.8_support branch November 28, 2022 21:30
hainan-xv pushed a commit to hainan-xv/NeMo that referenced this pull request Nov 29, 2022
* Fix issues with PL 1.8

Signed-off-by: SeanNaren <[email protected]>

* Set scripting variable

Signed-off-by: SeanNaren <[email protected]>

* Fix missing arg

Signed-off-by: SeanNaren <[email protected]>

* Cleanup list

Signed-off-by: SeanNaren <[email protected]>

* Fix reference

Signed-off-by: SeanNaren <[email protected]>

* Try to fix hanging EMA test

Signed-off-by: SeanNaren <[email protected]>

* Missing \

Signed-off-by: SeanNaren <[email protected]>

* Add strategy

Signed-off-by: SeanNaren <[email protected]>

* See if setting the chdir fixes the hanging DDP test

Signed-off-by: SeanNaren <[email protected]>

* See if removing the subdir setter fixes the issue

Signed-off-by: SeanNaren <[email protected]>

* Remove checks

Signed-off-by: SeanNaren <[email protected]>

* Try [0,1] for devices

Signed-off-by: SeanNaren <[email protected]>

* Add code back

Signed-off-by: SeanNaren <[email protected]>

* Remove space

Signed-off-by: SeanNaren <[email protected]>

* Update requirements

Signed-off-by: SeanNaren <[email protected]>

* Swap import path

Signed-off-by: SeanNaren <[email protected]>

* Update references

Signed-off-by: SeanNaren <[email protected]>

* Fix deprecated variables

Signed-off-by: SeanNaren <[email protected]>

* Fix missing var

Signed-off-by: SeanNaren <[email protected]>

* Fix var

Signed-off-by: SeanNaren <[email protected]>

* Revert changes

Signed-off-by: SeanNaren <[email protected]>

* Address review

Signed-off-by: SeanNaren <[email protected]>

Signed-off-by: SeanNaren <[email protected]>
Co-authored-by: Oleksii Kuchaiev <[email protected]>
Signed-off-by: Hainan Xu <[email protected]>
hainan-xv pushed a commit to hainan-xv/NeMo that referenced this pull request Nov 29, 2022
* Fix issues with PL 1.8

Signed-off-by: SeanNaren <[email protected]>

* Set scripting variable

Signed-off-by: SeanNaren <[email protected]>

* Fix missing arg

Signed-off-by: SeanNaren <[email protected]>

* Cleanup list

Signed-off-by: SeanNaren <[email protected]>

* Fix reference

Signed-off-by: SeanNaren <[email protected]>

* Try to fix hanging EMA test

Signed-off-by: SeanNaren <[email protected]>

* Missing \

Signed-off-by: SeanNaren <[email protected]>

* Add strategy

Signed-off-by: SeanNaren <[email protected]>

* See if setting the chdir fixes the hanging DDP test

Signed-off-by: SeanNaren <[email protected]>

* See if removing the subdir setter fixes the issue

Signed-off-by: SeanNaren <[email protected]>

* Remove checks

Signed-off-by: SeanNaren <[email protected]>

* Try [0,1] for devices

Signed-off-by: SeanNaren <[email protected]>

* Add code back

Signed-off-by: SeanNaren <[email protected]>

* Remove space

Signed-off-by: SeanNaren <[email protected]>

* Update requirements

Signed-off-by: SeanNaren <[email protected]>

* Swap import path

Signed-off-by: SeanNaren <[email protected]>

* Update references

Signed-off-by: SeanNaren <[email protected]>

* Fix deprecated variables

Signed-off-by: SeanNaren <[email protected]>

* Fix missing var

Signed-off-by: SeanNaren <[email protected]>

* Fix var

Signed-off-by: SeanNaren <[email protected]>

* Revert changes

Signed-off-by: SeanNaren <[email protected]>

* Address review

Signed-off-by: SeanNaren <[email protected]>

Signed-off-by: SeanNaren <[email protected]>
Co-authored-by: Oleksii Kuchaiev <[email protected]>
Signed-off-by: Hainan Xu <[email protected]>
hainan-xv pushed a commit to hainan-xv/NeMo that referenced this pull request Dec 5, 2022
* Fix issues with PL 1.8

Signed-off-by: SeanNaren <[email protected]>

* Set scripting variable

Signed-off-by: SeanNaren <[email protected]>

* Fix missing arg

Signed-off-by: SeanNaren <[email protected]>

* Cleanup list

Signed-off-by: SeanNaren <[email protected]>

* Fix reference

Signed-off-by: SeanNaren <[email protected]>

* Try to fix hanging EMA test

Signed-off-by: SeanNaren <[email protected]>

* Missing \

Signed-off-by: SeanNaren <[email protected]>

* Add strategy

Signed-off-by: SeanNaren <[email protected]>

* See if setting the chdir fixes the hanging DDP test

Signed-off-by: SeanNaren <[email protected]>

* See if removing the subdir setter fixes the issue

Signed-off-by: SeanNaren <[email protected]>

* Remove checks

Signed-off-by: SeanNaren <[email protected]>

* Try [0,1] for devices

Signed-off-by: SeanNaren <[email protected]>

* Add code back

Signed-off-by: SeanNaren <[email protected]>

* Remove space

Signed-off-by: SeanNaren <[email protected]>

* Update requirements

Signed-off-by: SeanNaren <[email protected]>

* Swap import path

Signed-off-by: SeanNaren <[email protected]>

* Update references

Signed-off-by: SeanNaren <[email protected]>

* Fix deprecated variables

Signed-off-by: SeanNaren <[email protected]>

* Fix missing var

Signed-off-by: SeanNaren <[email protected]>

* Fix var

Signed-off-by: SeanNaren <[email protected]>

* Revert changes

Signed-off-by: SeanNaren <[email protected]>

* Address review

Signed-off-by: SeanNaren <[email protected]>

Signed-off-by: SeanNaren <[email protected]>
Co-authored-by: Oleksii Kuchaiev <[email protected]>
Signed-off-by: Hainan Xu <[email protected]>
andrusenkoau pushed a commit to andrusenkoau/NeMo that referenced this pull request Jan 5, 2023
* Fix issues with PL 1.8

Signed-off-by: SeanNaren <[email protected]>

* Set scripting variable

Signed-off-by: SeanNaren <[email protected]>

* Fix missing arg

Signed-off-by: SeanNaren <[email protected]>

* Cleanup list

Signed-off-by: SeanNaren <[email protected]>

* Fix reference

Signed-off-by: SeanNaren <[email protected]>

* Try to fix hanging EMA test

Signed-off-by: SeanNaren <[email protected]>

* Missing \

Signed-off-by: SeanNaren <[email protected]>

* Add strategy

Signed-off-by: SeanNaren <[email protected]>

* See if setting the chdir fixes the hanging DDP test

Signed-off-by: SeanNaren <[email protected]>

* See if removing the subdir setter fixes the issue

Signed-off-by: SeanNaren <[email protected]>

* Remove checks

Signed-off-by: SeanNaren <[email protected]>

* Try [0,1] for devices

Signed-off-by: SeanNaren <[email protected]>

* Add code back

Signed-off-by: SeanNaren <[email protected]>

* Remove space

Signed-off-by: SeanNaren <[email protected]>

* Update requirements

Signed-off-by: SeanNaren <[email protected]>

* Swap import path

Signed-off-by: SeanNaren <[email protected]>

* Update references

Signed-off-by: SeanNaren <[email protected]>

* Fix deprecated variables

Signed-off-by: SeanNaren <[email protected]>

* Fix missing var

Signed-off-by: SeanNaren <[email protected]>

* Fix var

Signed-off-by: SeanNaren <[email protected]>

* Revert changes

Signed-off-by: SeanNaren <[email protected]>

* Address review

Signed-off-by: SeanNaren <[email protected]>

Signed-off-by: SeanNaren <[email protected]>
Co-authored-by: Oleksii Kuchaiev <[email protected]>
Signed-off-by: andrusenkoau <[email protected]>
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.

3 participants