Skip to content

Add options to add mp_policy and parallel_fn for NeMo automodel fsdp2#11956

Merged
ko3n1g merged 6 commits intomainfrom
boxiangw/fsdp2-nonmcore-refactor
Jan 27, 2025
Merged

Add options to add mp_policy and parallel_fn for NeMo automodel fsdp2#11956
ko3n1g merged 6 commits intomainfrom
boxiangw/fsdp2-nonmcore-refactor

Conversation

@BoxiangW
Copy link
Collaborator

What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

Collection: [Note which collection this PR will affect]

Changelog

  • Add specific line by line info of high level changes in this PR.

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: Boxiang Wang <boxiangw@nvidia.com>
Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>
@BoxiangW BoxiangW requested a review from akoumpa January 25, 2025 01:52
@BoxiangW BoxiangW self-assigned this Jan 25, 2025
Signed-off-by: BoxiangW <boxiangw@nvidia.com>
@BoxiangW BoxiangW enabled auto-merge (squash) January 25, 2025 01:53
BoxiangW and others added 2 commits January 25, 2025 01:53
Signed-off-by: BoxiangW <BoxiangW@users.noreply.github.com>
Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>
Signed-off-by: BoxiangW <BoxiangW@users.noreply.github.com>
@github-actions
Copy link
Contributor

beep boop 🤖: 🚨 The following files must be fixed before merge!


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

************* Module nemo.collections.speechlm.models.hf_auto_model_for_speech_seq2seq
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:28:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:36:0: C0115: Missing class docstring (missing-class-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:73:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:86:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:92:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:95:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:121:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:128:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:140:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/speechlm/models/hf_auto_model_for_speech_seq2seq.py:145:4: C0116: Missing function or method docstring (missing-function-docstring)

-----------------------------------
Your code has been rated at 9.43/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!

@github-actions
Copy link
Contributor

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.llm.gpt.model.hf_auto_model_for_causal_lm
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:28:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:36:0: C0115: Missing class docstring (missing-class-docstring)
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:78:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:89:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:92:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:126:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:129:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:152:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/llm/gpt/model/hf_auto_model_for_causal_lm.py:172:4: C0116: Missing function or method docstring (missing-function-docstring)
************* Module nemo.lightning.pytorch.strategies.utils
nemo/lightning/pytorch/strategies/utils.py:41:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/pytorch/strategies/utils.py:50:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/utils.py:58:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/utils.py:70:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/utils.py:86:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/utils.py:121:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/utils.py:143:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/pytorch/strategies/utils.py:198:0: C0116: Missing function or method docstring (missing-function-docstring)

-----------------------------------
Your code has been rated at 9.43/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!

@github-actions
Copy link
Contributor

[🤖]: Hi @BoxiangW 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully

So it might be time to merge this PR or get some approvals

I'm just a bot so I'll leave it you what to do next.

//cc @pablo-garay @ko3n1g

Copy link
Collaborator

@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.

Thank you @BoxiangW for all the work refactoring.

In the future, as external factors permit, things like mp_policy config will be moved as an individual argument, instead of creating the config inside the init function.

@ko3n1g ko3n1g disabled auto-merge January 27, 2025 18:53
@ko3n1g ko3n1g merged commit b9bdd45 into main Jan 27, 2025
22 of 23 checks passed
@ko3n1g ko3n1g deleted the boxiangw/fsdp2-nonmcore-refactor branch January 27, 2025 18:53
abhinavg4 pushed a commit that referenced this pull request Jan 30, 2025
…#11956)

* Init change

Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>

* Add options to passin mp_policy and parallelize_fn

Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>

* Update utils.py

Signed-off-by: BoxiangW <boxiangw@nvidia.com>

* Apply isort and black reformatting

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

* Add MixedPrecisionPolicy configs

Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>

* Apply isort and black reformatting

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

---------

Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>
Signed-off-by: BoxiangW <boxiangw@nvidia.com>
Signed-off-by: BoxiangW <BoxiangW@users.noreply.github.com>
Co-authored-by: BoxiangW <BoxiangW@users.noreply.github.com>
Signed-off-by: Abhinav Garg <abhgarg@nvidia.com>
youngeunkwon0405 pushed a commit to youngeunkwon0405/NeMo that referenced this pull request Feb 10, 2025
…NVIDIA-NeMo#11956)

* Init change

Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>

* Add options to passin mp_policy and parallelize_fn

Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>

* Update utils.py

Signed-off-by: BoxiangW <boxiangw@nvidia.com>

* Apply isort and black reformatting

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

* Add MixedPrecisionPolicy configs

Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>

* Apply isort and black reformatting

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

---------

Signed-off-by: Boxiang Wang <boxiangw@nvidia.com>
Signed-off-by: BoxiangW <boxiangw@nvidia.com>
Signed-off-by: BoxiangW <BoxiangW@users.noreply.github.com>
Co-authored-by: BoxiangW <BoxiangW@users.noreply.github.com>
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants