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

Add MCore FSDP2 support #11216

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft

Add MCore FSDP2 support #11216

wants to merge 15 commits into from

Conversation

BoxiangW
Copy link
Collaborator

@BoxiangW BoxiangW commented Nov 7, 2024

What does this PR do ?

Add MCore FSDP2 support

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)

blahBlahhhJ and others added 6 commits September 19, 2024 09:57
Signed-off-by: jasonwan <jasonwan@nvidia.com>
Signed-off-by: jasonwan <jasonwan@nvidia.com>
Signed-off-by: jasonwan <jasonwan@nvidia.com>
Signed-off-by: blahBlahhhJ <blahBlahhhJ@users.noreply.github.com>
Signed-off-by: BoxiangW <BoxiangW@users.noreply.github.com>
@BoxiangW BoxiangW self-assigned this Nov 8, 2024
@BoxiangW BoxiangW added feature request/PR for a new feature Run CICD labels Nov 8, 2024
@BoxiangW BoxiangW added Run CICD and removed Run CICD labels Nov 8, 2024
Signed-off-by: BoxiangW <45734921+BoxiangW@users.noreply.github.com>
@BoxiangW BoxiangW added Run CICD and removed Run CICD labels Nov 8, 2024
BoxiangW and others added 6 commits November 12, 2024 16:32
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>
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.lightning.megatron_parallel
nemo/lightning/megatron_parallel.py:250:0: C0301: Line too long (127/119) (line-too-long)
nemo/lightning/megatron_parallel.py:251:0: C0301: Line too long (140/119) (line-too-long)
nemo/lightning/megatron_parallel.py:252:0: C0301: Line too long (130/119) (line-too-long)
nemo/lightning/megatron_parallel.py:558:0: C0301: Line too long (129/119) (line-too-long)
nemo/lightning/megatron_parallel.py:565:0: C0301: Line too long (135/119) (line-too-long)
nemo/lightning/megatron_parallel.py:863:0: C0301: Line too long (137/119) (line-too-long)
nemo/lightning/megatron_parallel.py:1093:0: C0301: Line too long (136/119) (line-too-long)
nemo/lightning/megatron_parallel.py:1660:0: C0301: Line too long (128/119) (line-too-long)
nemo/lightning/megatron_parallel.py:1699:0: C0301: Line too long (146/119) (line-too-long)
nemo/lightning/megatron_parallel.py:73:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/megatron_parallel.py:74:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:76:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:111:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:115:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:318:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:342:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:368:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:394:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:530:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:573:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:577:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:640:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:676:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:683:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:717:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:725:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:741:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:768:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:780:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/megatron_parallel.py:802:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:811:4: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/megatron_parallel.py:833:8: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:1353:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:1528:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/megatron_parallel.py:1534:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:1540:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:1544:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:1549:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/megatron_parallel.py:1554:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/megatron_parallel.py:1582:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:1628:8: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:1650:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/megatron_parallel.py:1723:0: C0115: Missing class docstring (missing-class-docstring)
nemo/lightning/megatron_parallel.py:1762:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:1776:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/lightning/megatron_parallel.py:51:0: W0611: Unused TrainerFn imported from pytorch_lightning.trainer.states (unused-import)

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

Thank you for improving NeMo's documentation!

from megatron.core.distributed import TorchFullyShardedDataParallel as McoreTorchFSDP

HAVE_MCORE_FSDP2 = True
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException' Note

Except block directly handles BaseException.
@@ -193,6 +195,7 @@ def __init__(
ckpt_load_optimizer: bool = True,
ckpt_save_optimizer: bool = True,
ddp: Union[DDPLiteral, DistributedDataParallelConfig] = "megatron",
fsdp: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we rename it torch_fsdp because we know we'll have mcore_fsdp eventually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request/PR for a new feature Run CICD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants