且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

张量流联邦学习检查点

更新时间:2022-11-30 15:30:48

要问的一个问题是,您是要比较 TFF(作为联合计算的一部分)还是事后变量/outside TFF(在 Python 中分析).

One question to ask is whether you want to compare the variables within TFF (as part of the federated computation) or post-hoc/outside TFF (analyzing within Python).

修改由 tff.learning.build_federated_averaging_process 可能是一个不错的选择.事实上,我建议在 tensorflow_federated/python/research/simple_fedavg/simple_fedavg.py,而不是深入研究 tff.learning.

Modifying the tff.utils.IterativeProcess construction performed by tff.learning.build_federated_averaging_process may be a good way to go. In fact, I'd recommend forking the simplified implementation on GitHub at tensorflow_federated/python/research/simple_fedavg/simple_fedavg.py, rather than digging into tff.learning.

更改norel291ofol#La> 执行 tff.fedetated_mean 从客户端更新到 tff.federated_collect 将列出所有客户的模型,然后可以与全局模型进行比较.

Changing the line that performs a tff.fedetated_mean on the updates from the clients to a tff.federated_collect will will give a list of all the client's models that can then be compared to the global model.

示例:

client_deltas = tff.federated_collect(client_outputs.weights_delta)

@tff.tf_computation(server_state.model.type_signature,
                    client_deltas.type_signature)
def compare_deltas_to_global(global_model, deltas):
  for delta in deltas:
    # do something with delta vs global_model 

tff.federated_apply(compare_deltas_to_global, (server_state.model, client_deltas))