adap / flower

Flower: A Friendly Federated AI Framework
https://flower.ai
Apache License 2.0
5.03k stars 862 forks source link

Add metadata to Client in client.py and read it inside server.py #2245

Open fredowashere opened 1 year ago

fredowashere commented 1 year ago

We are making ready-to-run client.py files on for our users and we have certain properties we would like to read inside the server.py.

Is it possible, and if so how, to define arbitrary metadata for each client.py file and to read this data inside the server.py?

jafermarq commented 1 year ago

Hey @fredowashere, if your clients have that metadata built-in when the client object is created, then the server can request that data using the get_properties() method. Alternatively you can share that metadata with the server via the last return argument in the client's fit() method. That argument is internally called "metrics". Then, in your strategy you'll be able to process (in the aggregate_fit() method) them the way you want.