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 optminizer _set_auxiliary_var bug #50335

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ def _get_input_varlist(self, program):
ret_list.append(var)
return ret_list

def _set_auxiliary_var(self, key, val):
super()._set_auxiliary_var(key, val)
self.inner_opt._set_auxiliary_var(key, val)

def minimize(
self,
loss,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def __init__(self, optimizer):
self.meta_optimizers_white_list = []
self.meta_optimizers_black_list = []

def _set_auxiliary_var(self, key, val):
super()._set_auxiliary_var(key, val)
self.inner_opt._set_auxiliary_var(key, val)

def _set_basic_info(
self, loss, role_maker, user_defined_optimizer, user_defined_strategy
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def __init__(
# Update optimizer parameters and adjust parameter storage and use according to rank.
self._update_opt_status()

def _set_auxiliary_var(self, key, val):
super()._set_auxiliary_var(key, val)
self._optim._set_auxiliary_var(key, val)

@paddle.autograd.no_grad()
def _sync_params_and_buffers(self):
"""
Expand Down
4 changes: 4 additions & 0 deletions python/paddle/incubate/optimizer/lookahead.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ def __init__(self, inner_optimizer, alpha=0.5, k=5, name=None):
self._global_step_var = None
self._k_var = None

def _set_auxiliary_var(self, key, val):
super()._set_auxiliary_var(key, val)
self.inner_optimizer._set_auxiliary_var(key, val)

@framework.dygraph_only
@imperative_base.no_grad
def step(self):
Expand Down