Endurance
Endurance

Reputation: 101

How to get client models (based on Keras) in tensorflow federated?

I am looking for a way to get client models as checkpoints that I can investigate as standard keras model. I looked into this question but it only provides the weights, is there a way to get or save models from clients directly during federated training?

Upvotes: 0

Views: 594

Answers (1)

Zachary Garrett
Zachary Garrett

Reputation: 2941

The answer referenced in the original question provides a method for sending back the model weights; what seems to be missing is how to assign those weights to a tf.keras.Model that has the same architecture? With tff.learning.assign_weights_to_keras_model, a Keras model instance can be initialized with the clients weights, and the instance will provide the standard Keras API (evaluate(), test_on_batch() etc).

The Federated Learning for Text Generation tutorial has an example of doing this.

Upvotes: 1

Related Questions