Collecting the weights returned by clients without aggregating them

社会主义新天地 提交于 2021-01-28 11:28:47

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/65772509/collecting-the-weights-returned-by-clients-without-aggregating-them

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!