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

Add momentum for the optimizer in server #86

Merged
merged 1 commit into from
May 13, 2022
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
3 changes: 2 additions & 1 deletion federatedscope/core/aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def __init__(self, config, model, device='cpu'):
self.device = device
self.optimizer = get_optimizer(type=config.fedopt.type_optimizer,
model=self.model,
lr=config.fedopt.lr_server)
lr=config.fedopt.lr_server,
momentum=config.fedopt.momentum_server)

def aggregate(self, agg_info):
new_model = super().aggregate(agg_info)
Expand Down
1 change: 1 addition & 0 deletions federatedscope/core/configs/cfg_fl_algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def extend_fl_algo_cfg(cfg):

cfg.fedopt.use = False
cfg.fedopt.lr_server = 0.01
cfg.fedopt.momentum_server = 0.
cfg.fedopt.type_optimizer = 'SGD'

# ------------------------------------------------------------------------ #
Expand Down