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

deepspeed-chat: fix incorrect lr when using lora only #756

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

mosheisland
Copy link
Contributor

When using lora only, get_optimizer_grouped_parameters() returns a list of 3 parameter groups, where only the second is not empty. Then, deepspeed removes empty parameter groups.
[ref: DeepSpeedEngine._configure_optimizer() deepspeed v0.10.3] However, the lr_scheduler still contains 3 groups. This causes the lr scheduler to update the lora params with the wrong lr.

Fix it by removing all empty groups in get_optimizer_grouped_parameters().

Change-Id: I520841312bdedd6a572cf4c827e0bbf06f983575

When using lora only, get_optimizer_grouped_parameters() returns a list of 3
parameter groups, where only the second is not empty.
Then, deepspeed removes empty parameter groups.
[ref: DeepSpeedEngine._configure_optimizer() deepspeed v0.10.3]
However, the lr_scheduler still contains 3 groups.
This causes the lr scheduler to update the lora params with the wrong lr.

Fix it by removing all empty groups in get_optimizer_grouped_parameters().

Change-Id: I520841312bdedd6a572cf4c827e0bbf06f983575
Signed-off-by: Moshe Island <[email protected]>
@tjruwase
Copy link
Contributor

tjruwase commented Oct 3, 2023

@awan-10 and @lekurile, FYI

@tjruwase tjruwase merged commit ca03bd7 into microsoft:master Oct 3, 2023
2 checks passed
@mosheisland mosheisland deleted the 7_fix_lr_when_lora_only branch October 17, 2023 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants