1

In the federated learning context, and like this tutorial shows, initial weights of global model (at server level) are initialized randomly with : state = iterative_process.initialize(). I want to have the hand to put these initial weights by downloading them from another model (load_model()). So please how can I proceed, I'm newer in TFF. Thanks

seni
  • 659
  • 1
  • 8
  • 20

1 Answers1

1

You can either manually create a state object with the same structure and any values you choose, or use tff.structure.update_struct.

If you already have a my_model, and instance of either tff.learning.Model or a tf.keras.Model with weights you want, you can write something like

state = tff.structure.update_struct(state, model=tff.learning.ModelWeights.from_model(my_model))

Zachary Garrett
  • 2,911
  • 15
  • 23
Jakub Konecny
  • 900
  • 5
  • 15