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

Fix multi_tensor adam/momentum bug when the parameter is list of dict #47352

Merged

Conversation

sneaxiy
Copy link
Collaborator

@sneaxiy sneaxiy commented Oct 26, 2022

PR types

Bug fixes

PR changes

APIs

Describe

When use_multi_tensor = True in Adam or Momentum optimizer and the parameters is a list of dict, the original codes were wrong because self._param_dict can only handle the first parameter group. The other parameter groups would reuse the self._param_dict from the first group, and the bug would occur.

This PR fixes this bug by adding param_group_idx to some method in Optimizer.

@sneaxiy sneaxiy changed the title Fix multi_tensor adam/momentum bug Fix multi_tensor adam/momentum bug when the parameter is list of dict Oct 26, 2022
@sneaxiy sneaxiy closed this Oct 26, 2022
@sneaxiy sneaxiy reopened this Oct 26, 2022
Copy link
Contributor

@zhangbo9674 zhangbo9674 left a comment

Choose a reason for hiding this comment

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

LGTM

@sneaxiy sneaxiy merged commit 4137c46 into PaddlePaddle:develop Oct 26, 2022
@sneaxiy sneaxiy deleted the fix_multi_tensor_adam_and_momentum branch October 26, 2022 08:30
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