-
Notifications
You must be signed in to change notification settings - Fork 534
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
enable param group configuration in llm-foundry #760
Merged
Merged
Conversation
This file contains 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
vchiley
force-pushed
the
param_group_config
branch
from
November 23, 2023 21:51
9a36cdc
to
f39592a
Compare
potential users: @sashaDoubov @samhavens @b-chu @bcui19 @ShashankMosaicML |
j316chuck
approved these changes
Nov 27, 2023
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.
Nice ✅ . Left a comment but thanks for the clean implementation.
dakinggg
approved these changes
Nov 28, 2023
vchiley
force-pushed
the
param_group_config
branch
from
November 29, 2023 00:06
017bf92
to
6b9ccbf
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR enables param group configuration in llm-foundry.
The optimizer_config defines the optimizer args.
This PR allows the user to additionally have key
disable_grad
which is a string or list of strings. If a string matches a parameter name, then that parameter will haverequires_grad=False
. This is useful for freezing parameters.This PR additionally allows the user to specify key
param_groups
which is a list of dicts. In this dict, keyparam_str_match
defines a string; if a parameter name contains this string, then it will be in this parameter group. This is useful for grouping parameters together. The dict can also contain any other key that is a valid optimizer arg.Note: to handle name overlap conflicts, params are assigned to parameter groups and added to
param_groups
in the order thatparam_str_match
appear inparam_groups
.Param name comparisons are done using RegEx search.
Usage
To disable gradient for all parameters that contain the string "norm" or "bias":
or in the yaml as:
To create modify the optimizer parameters for all parameters that contain the string "norm" separately:
of in yaml form: