-
Notifications
You must be signed in to change notification settings - Fork 906
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
Set initial_parameters
as non-optional for FedAvgM (#2369)
#2416
base: main
Are you sure you want to change the base?
Conversation
Hey @DanielCardeal, thanks for helping with the issue! The proposed change sounds reasonable. Would it make sense to keep it as optional and, in the first round, override the I presume it's easier for people to not worry with the conversion of their model (e.g. PyTorch) to the Any thoughts on this @danieljanes @charlesbvll @adam-narozniak @panh99 @gubertoli |
@jafermarq, I aggree that from a user perspective retrieving the parameters from a random client would be much easier. If possible (probably as a new issue) doing the same for FedOpt would also be great. Initializing these parameters is a recurrent question in Slack. |
@jafermarq @gubertoli Great idea! I will try to add this changes in the the next couple of days :) |
This change aims to better communicate to users the necessity of `initial_parameters` in case of server-side optimization, as well as expose which conditions must be met to enable server-side optimization.
This change makes so that FedAvgM uses the sampled global parameters of the server when no `initial_parameters` are passed in the constructor.
Hi, great catch. I'm in favor of @jafermarq 's idea. I think we should also add a warning saying if at least one of the default values for |
Hi I added the following changes to the PR:
Are there any further changes that need to be implemented? |
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.
Hi @DanielCardeal,
just a minor comment. I think we still want to not force users to pass initial_parameters
.
I like the WARNING_NO_SERVER_OPT
message you wrote to alert users. Do we want it to be displayed right upon strategy instantiation? Maybe yes? thoughts @adam-narozniak @danieljanes
It looks something like the below:
python run.py
WARNING flwr 2023-11-16 16:11:34,348 | fedavgm.py:132 |
Setting both `server_momentum` and `server_learning_rate` to default values
cause FedAvgM to work as a vanilla FedAvg strategy. Server optimization with
momentum is enabled if either `server_momentum` is set to a value greater than
0.0 or `server_learning_rate` is set to a value lower than 1.0.
INFO flwr 2023-11-16 16:11:34,349 | app.py:178 | Starting Flower simulation, config: ...
....
Issue
#2369
Description
The constructor parameter
initial_parameters
of the FedAvgM strategy is typed asOptional
, but is required whenever server-side optimization is enabled. This can be misleading, since server-side optimization is enabled "automatically" and in a non-transparent way.Related issues/PRs
Proposal
Change type of
intial_parameters
fromOptional[Parameters]
toParameters
in FedAvgM. Also, documents which conditions must be met for server-side optimization to be enabled.Explanation
This change aims to better communicate to users the necessity of
initial_parameters
in case of server-side optimization, as well as expose which conditions must be met to enable server-side optimization.Checklist
#contributions
)Any other comments?