I want to know if we can broadcast different models for each of the clients from the server in tensorflow_federated?
Can anyone please help?
I want to know if we can broadcast different models for each of the clients from the server in tensorflow_federated?
Can anyone please help?
Within the TFF language, there is not currently a way to express this. The contract of tff.federated_broadcast is that the value that arrives at each client is the same. There isn't an alternative communication intrinsic (yet) for other ways of moving tensors from server→clients.
That said, its possible to simulate clients that receive different weights. Setup the clients state outside TFF in the Python execution environment, then pass in a list (one element for each client). Example:
@tff.tf_computation(MODEL_WEIGHT_TYPE):
def client_work(model_weights):
# Do local training, or any other logic.
@tff.federated_computation(tff.FederatedType(MODEL_WEIGHT_TYPE, tff.CLIENTS))
def run_one_round(model):
return tff.federated_map(client_work, model)
client_models = [...] # a list of each client, possibly different models.
run_one_round(client_models)