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

Propogate dp last changes from mcore #12012

Merged
merged 12 commits into from
Feb 10, 2025
Merged

Conversation

ryantwolf
Copy link
Collaborator

@ryantwolf ryantwolf commented Jan 31, 2025

What does this PR do ?

Adds support for DP-last in NeMo like in megatron core.

Collection: [Note which collection this PR will affect]

Changelog

  • Updates rank order from tp-pp-dp to tp-cp-ep-pp-dp in parallel_state.initialize_model_parallel when use_tp_pp_dp_mapping is specified.
  • Propagates new assert check from mcore for DP last into NeMo
  • Adds use_tp_pp_dp_mapping to ParallelismConfig and ensures it is passed to MegatronStrategy and FabricMegatronStrategy
  • Fixes a bunch of Pylint and Flake8 errors in the files.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

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

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Copy link
Contributor

github-actions bot commented Feb 2, 2025

beep boop 🤖: 🙏 The following files have warnings. In case you are familiar with these, please try helping us to improve the code base.


Your code was analyzed with PyLint. The following annotations have been identified:

************* Module nemo.collections.nlp.modules.common.megatron.megatron_init
nemo/collections/nlp/modules/common/megatron/megatron_init.py:268:0: C0301: Line too long (122/119) (line-too-long)
nemo/collections/nlp/modules/common/megatron/megatron_init.py:269:0: C0301: Line too long (133/119) (line-too-long)
nemo/collections/nlp/modules/common/megatron/megatron_init.py:270:0: C0301: Line too long (121/119) (line-too-long)
nemo/collections/nlp/modules/common/megatron/megatron_init.py:373:0: C0301: Line too long (166/119) (line-too-long)
nemo/collections/nlp/modules/common/megatron/megatron_init.py:88:0: C0116: Missing function or method docstring (missing-function-docstring)
************* Module nemo.collections.nlp.parts.nlp_overrides
nemo/collections/nlp/parts/nlp_overrides.py:219:0: C0301: Line too long (140/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:224:0: C0301: Line too long (149/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:240:0: C0301: Line too long (123/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:431:0: C0301: Line too long (136/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:517:0: C0301: Line too long (152/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:741:0: C0301: Line too long (140/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:746:0: C0301: Line too long (149/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:1012:0: C0301: Line too long (128/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:1016:0: C0301: Line too long (141/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:1020:0: C0301: Line too long (149/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:1077:0: C0301: Line too long (135/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:1204:0: C0301: Line too long (121/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:1786:0: C0301: Line too long (152/119) (line-too-long)
nemo/collections/nlp/parts/nlp_overrides.py:255:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:388:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:432:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:613:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:629:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:648:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:889:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:1008:0: C0115: Missing class docstring (missing-class-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:1697:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:1785:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/parts/nlp_overrides.py:18:0: W0611: Unused import re (unused-import)
nemo/collections/nlp/parts/nlp_overrides.py:107:4: W0611: Unused tensorstore imported from megatron.core.dist_checkpointing.strategies (unused-import)
************* Module nemo.lightning.megatron_init
nemo/lightning/megatron_init.py:270:0: C0301: Line too long (122/119) (line-too-long)
nemo/lightning/megatron_init.py:271:0: C0301: Line too long (133/119) (line-too-long)
nemo/lightning/megatron_init.py:272:0: C0301: Line too long (121/119) (line-too-long)
nemo/lightning/megatron_init.py:375:0: C0301: Line too long (166/119) (line-too-long)
nemo/lightning/megatron_init.py:88:0: C0116: Missing function or method docstring (missing-function-docstring)

-----------------------------------
Your code has been rated at 9.73/10

Mitigation guide:

  • Add sensible and useful docstrings to functions and methods
  • For trivial methods like getter/setters, consider adding # pylint: disable=C0116 inside the function itself
  • To disable multiple functions/methods at once, put a # pylint: disable=C0116 before the first and a # pylint: enable=C0116 after the last.

By applying these rules, we reduce the occurance of this message in future.

Thank you for improving NeMo's documentation!

akoumpa
akoumpa previously approved these changes Feb 5, 2025
Copy link
Member

@akoumpa akoumpa left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@ryantwolf ryantwolf marked this pull request as ready for review February 5, 2025 18:25
Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>
ryantwolf and others added 3 commits February 5, 2025 13:24
Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>
ananthsub
ananthsub previously approved these changes Feb 5, 2025
Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>
akoumpa
akoumpa previously approved these changes Feb 7, 2025
@akoumpa akoumpa added Run CICD and removed Run CICD labels Feb 7, 2025
Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
@akoumpa akoumpa removed the Run CICD label Feb 9, 2025
@ryantwolf ryantwolf requested a review from akoumpa February 9, 2025 21:48
@akoumpa akoumpa merged commit b3dcfd0 into NVIDIA:main Feb 10, 2025
232 checks passed
dimapihtar pushed a commit that referenced this pull request Feb 10, 2025
* Propogate dp last changes from mcore

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Add test for new args

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* FIx pylint issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix flake8 issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix argument name in test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Fix test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

---------

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>
Co-authored-by: ryantwolf <ryantwolf@users.noreply.github.com>
youngeunkwon0405 pushed a commit to youngeunkwon0405/NeMo that referenced this pull request Feb 10, 2025
* Propogate dp last changes from mcore

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Add test for new args

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* FIx pylint issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix flake8 issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix argument name in test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Fix test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

---------

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>
Co-authored-by: ryantwolf <ryantwolf@users.noreply.github.com>
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
youngeunkwon0405 pushed a commit to youngeunkwon0405/NeMo that referenced this pull request Feb 10, 2025
* Propogate dp last changes from mcore

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Add test for new args

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* FIx pylint issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix flake8 issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix argument name in test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Fix test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

---------

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>
Co-authored-by: ryantwolf <ryantwolf@users.noreply.github.com>
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
@ryantwolf ryantwolf deleted the rywolf/dp-last branch February 18, 2025 18:25
tomlifu pushed a commit to tomlifu/NeMo that referenced this pull request Feb 20, 2025
* Propogate dp last changes from mcore

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Add test for new args

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* FIx pylint issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix flake8 issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix argument name in test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Fix test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

---------

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>
Co-authored-by: ryantwolf <ryantwolf@users.noreply.github.com>
tomlifu pushed a commit to tomlifu/NeMo that referenced this pull request Feb 20, 2025
* Propogate dp last changes from mcore

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Add test for new args

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* FIx pylint issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix flake8 issues

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Apply isort and black reformatting

Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>

* Fix argument name in test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

* Fix test

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>

---------

Signed-off-by: Ryan Wolf <rywolf@nvidia.com>
Signed-off-by: ryantwolf <ryantwolf@users.noreply.github.com>
Co-authored-by: ryantwolf <ryantwolf@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants