收集客户返回的权重而不进行汇总 [英] Collecting the weights returned by clients without aggregating them
问题描述
我想知道最简单的方法来创建模型,使用联邦的tensorflow广播模型,运行一个周期并收集客户端返回的权重而不将它们与fedavg进行汇总.
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.
推荐答案
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.
这里有几件事要注意.首先,据我所知,没有一个生产"系统支持 federated_collect
.其次,根据您的需求,可能有一个更简单,更直接的解决方案:只需自行返回客户权重即可.TFF运行时将具体化一个客户端权重的Python列表(我相信是张量很高的张量),您可以在该列表上执行任意python后处理.
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.
这篇关于收集客户返回的权重而不进行汇总的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!