-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Dion optimizer support #3014
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
Merged
Merged
Dion optimizer support #3014
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
09e85f2
Add support for Dion optimizer
winglian 60c1ed4
dion training kwargs
winglian 4c437af
fix var names
winglian 972aed8
no dion 8bit for now
winglian 6bb8d42
use updated axolotl-contribs-mit for dion optimizer
winglian 57d6895
add smoke test for dion optimizer
winglian 6b764ba
add docs
winglian dcb5de8
fix typo during edits
winglian a321454
fix test to not remove load in 8bit
winglian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| title: Optimizers | ||
| description: Configuring optimizers | ||
| --- | ||
|
|
||
| ### Dion Optimizer | ||
|
|
||
| Microsoft's Dion (DIstributed OrthoNormalization) optimizer is a scalable and communication-efficient | ||
| orthonormalizing optimizer that uses low-rank approximations to reduce gradient communication. | ||
|
|
||
| Usage: | ||
|
|
||
| ```yaml | ||
| optimizer: dion | ||
| dion_lr: 0.01 | ||
| dion_momentum: 0.95 | ||
| lr: 0.00001 # learning rate for embeddings and parameters that fallback to AdamW | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling for required Dion parameters.
The code assumes
dion_learning_rateanddion_momentumare always present intraining_args_kwargs, but these could beNoneor missing, which would cause runtime errors.Add validation for required parameters:
elif self.cfg.optimizer == "dion": from axolotl.contribs.mit.dion import ( # pylint: disable=no-name-in-module DionOptimizerFactory, ) optimizer_cls = DionOptimizerFactory + + dion_lr = training_args_kwargs.get("dion_learning_rate") + dion_mu = training_args_kwargs.get("dion_momentum") + + if dion_lr is None: + raise ValueError("dion_learning_rate is required when using dion optimizer") + if dion_mu is None: + raise ValueError("dion_momentum is required when using dion optimizer") + - optimizer_kwargs["dion_lr"] = training_args_kwargs["dion_learning_rate"] - optimizer_kwargs["dion_mu"] = training_args_kwargs["dion_momentum"] + optimizer_kwargs["dion_lr"] = dion_lr + optimizer_kwargs["dion_mu"] = dion_mu optimizer_kwargs.update(adam_kwargs) partial_state = PartialState() optimizer_kwargs["device_mesh"] = partial_state.device_mesh📝 Committable suggestion
🤖 Prompt for AI Agents