Reputation: 33
I would like to know the easiest way to create a model, broadcast it with tensorflow federated, run a cycle and collect the weights returned by clients without aggregating them with the fedavg.
Upvotes: 1
Views: 312
Reputation: 1405
TFF provides the tff.federated_collect
intrinsic for this purpose; it materializes a stream of client data at the server.
One easy way to wire this into the guts of a mostly-existing federated procedure would be to fork simple_fedavg
, which I think is a reasonable starting point for working with TFF's lower-level capabilities.
There are a few things to note here. First, no 'production' system of which I am aware supports federated_collect
. Second, depending on your desire, there is possibly an easier and more straightforward solution: just return the client weights themselves. The TFF runtime will materialize a Python list of client weights (as eager tensors I believe), on which you can perform arbitrary python postprocessing.
To get here from simple_fedavg
, you would effectively return the client_outputs
directly instead of passing them to tff.federated_mean
. This would give you the client deltas (IE, the difference between the final client weights and the initial client weights); you could, however, simply modify client_update
to avoid computing this difference if desired.
Upvotes: 2