Skip to content

ModelOpt Knowledge-Distillation support - #880

Merged
AAnoosheh merged 24 commits into
mainfrom
aanoosheh/modelopt-kd
Nov 3, 2025
Merged

ModelOpt Knowledge-Distillation support#880
AAnoosheh merged 24 commits into
mainfrom
aanoosheh/modelopt-kd

Conversation

@AAnoosheh

@AAnoosheh AAnoosheh commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

#659

Integrate Disitllation support from Nvidia Model Optimizer into Megatron-Bridge, similarly to how it was done in Megatron-LM and NeMo

@copy-pr-bot

copy-pr-bot Bot commented Oct 6, 2025

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ananthsub ananthsub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this LGTM. we also need:

@@ -0,0 +1,201 @@
#!/usr/bin/env python3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd strongly recommend keeping the examples to be as python-based as possible with minimal config dependencies. I am planning to rework the llama recipe example as it was added initially to demonstrate config overrides, but i think it ends up detracting from seeing the main APIs at work.

Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
This reverts commit 9f0fc9e.

Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
@AAnoosheh
AAnoosheh force-pushed the aanoosheh/modelopt-kd branch from c352594 to 1abcf1d Compare October 29, 2025 12:14
@AAnoosheh
AAnoosheh marked this pull request as ready for review October 29, 2025 12:15
@AAnoosheh
AAnoosheh requested a review from a team as a code owner October 29, 2025 12:15
Comment thread pyproject.toml Outdated
Comment on lines 104 to 105
"nvidia-modelopt[torch]>=0.37.0,<0.39.0",
"torch; sys_platform == 'never'",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this override?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Need newer version without dealing with MLM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

At least if @ananthsub wants to try and cherry-pick this PR by end of week

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm lifting the pin here: NVIDIA/Megatron-LM#2046

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This will be reflected in CICD build by tomorrow?

@ananthsub ananthsub added the r0.2.0 Cherry-pick label for r0.2.0 release branch label Oct 29, 2025
@ananthsub

Copy link
Copy Markdown
Contributor

/ok to test 1abcf1d

ananthsub
ananthsub previously approved these changes Oct 31, 2025
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
@AAnoosheh

Copy link
Copy Markdown
Contributor Author

/ok to test 7bd8165

@AAnoosheh
AAnoosheh merged commit eaec2b2 into main Nov 3, 2025
29 checks passed
@AAnoosheh
AAnoosheh deleted the aanoosheh/modelopt-kd branch November 3, 2025 17:22
chtruong814 pushed a commit that referenced this pull request Nov 3, 2025
Signed-off-by: Asha Anoosheh <aanoosheh@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>

## Limitations

* Only GPT-based checkpoints are currently supported.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

below it says only GPT and Mamba based models are supported, but here it says only GPT

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess there's a naming ambiguity here. In MCore the Mamba models are subclasses of GPTModel, so it's kind of referring to that. Though I should make it more clear anyway, thanks

model.teacher.tensor_model_parallel_size=2
```

### Combining YAML and CLI Overrides

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

when would a user need to combine yaml config with CLI overrides? would it be cleaner to enforce that the user must update the yaml to change any parameter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See the other examples, I just followed their format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r0.2.0 Cherry-pick label for r0.2.0 release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants