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

feat: support for mcore optimizer (to enable MoE) #380

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

terrykong
Copy link
Collaborator

@terrykong terrykong commented Nov 5, 2024

What does this PR do ?

  • Finishes up support for mcore optimizer
  • adds tests for mixtral EP and mixtral TP + SP + peft

Rebase stack

Changelog

  • Please update the CHANGELOG.md under next version with high level changes in this PR.

Usage

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

Before your PR is "Ready for review"

Pre checks:

Checklist when contributing a new algorithm

  • Does the trainer resume and restore model state all states?
  • Does the trainer support all parallelism techniques(PP, TP, DP)?
  • Does the trainer support max_steps=-1 and validation?
  • Does the trainer only call APIs defined in alignable_interface.py?
  • Does the trainer have proper logging?

Additional Information

  • Related to # (issue)

@terrykong terrykong force-pushed the tk/dpo-moe-fix branch 2 times, most recently from 56163e1 to 4fd8963 Compare November 7, 2024 17:18
@terrykong terrykong changed the title feat: DPO support for mcore optimizer and MoE feat: support for mcore optimizer to enable MoE and support global padding to multiple for DPO Nov 7, 2024
@terrykong
Copy link
Collaborator Author

The DPO dataset changes should stand on their own, but are needed to test the mcore opt changes for moe. If moe issues take too long to resolve, I'll break this up.

@terrykong terrykong force-pushed the tk/dpo-moe-fix branch 3 times, most recently from 9a48bf1 to b9cf184 Compare November 7, 2024 18:55
@terrykong terrykong changed the title feat: support for mcore optimizer to enable MoE and support global padding to multiple for DPO feat: support for mcore optimizer to enable MoE Nov 7, 2024
@terrykong terrykong changed the title feat: support for mcore optimizer to enable MoE feat: support for mcore optimizer (to enable MoE) Nov 7, 2024
@terrykong terrykong requested a review from gshennvm November 7, 2024 19:51
@terrykong terrykong mentioned this pull request Nov 8, 2024
8 tasks
@terrykong terrykong force-pushed the tk/dpo-moe-fix branch 7 times, most recently from b1bca36 to ccce0b3 Compare November 15, 2024 07:46
@terrykong terrykong requested a review from ashors1 November 15, 2024 07:48
@terrykong terrykong added the Run CICD Set + un-set to retrigger label Nov 15, 2024
@terrykong terrykong marked this pull request as ready for review November 20, 2024 20:48
ashors1
ashors1 previously approved these changes Nov 22, 2024
@terrykong terrykong changed the base branch from main to dev December 2, 2024 23:47
@terrykong terrykong dismissed ashors1’s stale review December 2, 2024 23:47

The base branch was changed.

@terrykong terrykong added Run CICD Set + un-set to retrigger and removed Run CICD Set + un-set to retrigger labels Dec 3, 2024
@terrykong terrykong force-pushed the tk/dpo-moe-fix branch 3 times, most recently from e897fd7 to eab96f2 Compare December 6, 2024 22:37
Signed-off-by: Terry Kong <[email protected]>

moe test is all2all

Signed-off-by: Terry Kong <[email protected]>

other params

Signed-off-by: Terry Kong <[email protected]>

fix peft mixtral

Signed-off-by: Terry Kong <[email protected]>

dockerfile bump to be on dev

Signed-off-by: Terry Kong <[email protected]>

just take dockerfile on dev

Signed-off-by: Terry Kong <[email protected]>
@terrykong terrykong added Run CICD Set + un-set to retrigger and removed Run CICD Set + un-set to retrigger labels Jan 10, 2025
# from multiple simultaneous NCCL calls
ptl_model._optimizer._finish_bucket_grad_sync()
# Mcore DistOpt handles this, so we don't have to
if not ptl_model.use_mcore_dist_optim:
Copy link
Collaborator

Choose a reason for hiding this comment

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

how do you feel about dropping support for non mcore dist optim? are they equivalent to apex now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea, i want to do that in a follow up PR (would help our build times immensely). This just adds the feature without breaking apex

@@ -150,7 +150,7 @@ def train_single_step(self, batch):
grad_norm = grad_norm.item() if torch.is_tensor(grad_norm) else grad_norm
lr = self.optimizer.param_groups[0]["lr"]

self.optimizer.step()
self.optimizer.step(closure=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we have to specify the closure now? i thought this was optional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for mcore dist opt it's required, so i just set it everywhere

Signed-off-by: Terry Kong <[email protected]>
@terrykong terrykong added Run CICD Set + un-set to retrigger and removed Run CICD Set + un-set to retrigger labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algorithms CI Run CICD Set + un-set to retrigger Utils
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants