如何轻松保存 Tensorflow 联合模型?(状态)
几个月前,我在导入ServerState和FileCheckPointManager后使用了这个解决方案,它起作用了:
# Create the checkpoint Manager
ckpt_manager = FileCheckpointManager(root_dir=checkpoint_dir)
# Save checkpoint for round N
ckpt_manager.save_checkpoint(ServerState.from_tff_result(state), round_num=NUM_ROUNDS)
但是现在这个解决方案不再有效,因为ServerState不再包含from_tff_result
methotd。
AttributeError: type object 'ServerState' has no attribute 'from_tff_result'
还使用包含方法的旧版本的 ServerState 我得到:
TypeError: Expected tensorflow_federated.python.common_libs.structure.Struct, found tensorflow_federated.python.learning.model_utils.ModelWeights.
如何轻松保存我的联合模型?