-
Notifications
You must be signed in to change notification settings - Fork 34
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-1102 | Simplify ClientAPI and add support for inference #726
Conversation
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.
Nice, I think it will be helpful to have something like this.
However I think we can make it even neater, I have some ideas, let's talk about it.
Yes, let's! |
} | ||
|
||
# Do your training here, out_model is your result... | ||
out_model = in_model |
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.
I think it is better to give a minimal, but working example. This could be confusing.
fedn/network/clients/README.rst
Outdated
"lr": 1, | ||
} | ||
|
||
config = { |
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.
Don't understand this. How can the client set the round_id?
fedn/network/clients/README.rst
Outdated
return metrics | ||
|
||
def main(api_url: str, api_port: int, token: str = None): | ||
print(f"API URL: {api_url}") |
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.
Remove printouts?
|
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.
Imo I think you should change the Name of ClientAPI to maybe Project, ProjectManager, Context, ContextManager and import it into the root init so that you can:
from fedn import Context
Changed name of client api
|
Added a readme file to the client directory. This is an attempt to make users see how easy they can create their own clients.
Benjamin:
Key changes
grpc_handler.py
create_update_message
,create_validation_message
andcreate_prediction_message
which populate and return a gRPC message of the relevant typesend_model_update()
now takes a ModelUpdate message as input directly and only handles logic for sending the message to the serverclient_api.py
_subscribers
withtrain_callback
andvalidate_callback
train_callback
needs to take in_model as parameter and return out_model and metadata dictvalidate_callback
needs to take in_model as parameter and return metrics dict_task_stream_callback
now invokesupdate_local_model
orvalidate_global_model
depending on task request typeupdate_local_model
andvalidate_global_model
contain boiler plate code that was previously inside theon_train
andon_validate
callbacks (getting/sending model from/to combiner, generating uuid, assembling metadata, sending model update/validation)train
andvalidate
run
method creates a child thread for heart beats and listens to task stream in main threadupdate_local_model
,validate_global_model
andpredict_global_model
respectively and are sent in status and to GrpcHandlerclient_v2.py
README.rst