-
Notifications
You must be signed in to change notification settings - Fork 36
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
Feature/SK-946 | Add functionality for user defined server-functions #666
Conversation
fedn/network/api/client.py
Outdated
@@ -574,6 +574,7 @@ def start_session( | |||
helper: str = "", | |||
min_clients: int = 1, | |||
requested_clients: int = 8, | |||
function_provider_path: str = None, |
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.
can't we have the FunctionProvider class as argument instead?
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.
That would be better since then the abstract class would prevent wrong structure on the class already at the API level. But I'm not sure what will happened with imports when the class gets stringified.. I'll investigate it :)
fedn/network/api/interface.py
Outdated
@@ -940,6 +945,7 @@ def start_session( | |||
helper="", | |||
min_clients=1, | |||
requested_clients=8, | |||
function_provider=None, |
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.
missing arg in doc string
print(f"Epoch {e}/{epochs-1} | Batch: {b}/{n_batches-1} | Loss: {loss.item()}") | ||
|
||
# Metadata needed for aggregation server side | ||
metadata = { |
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.
the naming of metadata now becomes confusing, should we call them aggregator_metadata vs model_metadata, or maybe in_metadata vs out_metadata?
self.name = "custom" | ||
self.code_set = False | ||
|
||
def get_model_metadata(self): |
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.
this I don't understand why it's in the aggregator? Why not include model_metadata as an arg in APIClient.start_session()?
Adds functionality for user-defined aggregation, client selection, and client config. Also creates a new "update_handler" where some code from the aggregator and roundhandler relating to updates are moved.
Adds a new option to the start_session() CLI command:
client.start_session(server_functions=ServerFunctions)
User-defined code will be run in the new hook container
One simple example that highlights the new functionalities. See examples/server-functions/server_functions.py