Sending a large message to Edge Devices

When running Flower code on edge devices I encounter this error:

What’s causing this issue?

1 Like

Hi @3249403788, thanks for asking the question over our discuss forum!

This error means that the size of your messages is exceeding the default limit of 512MB. You can raise that limit to ~2GB. You can raise this limit when you call start_client() – but you need to set this limit also when calling start_server().

So for example, if you want to double the maximum message size it would look like this:

import flwr as fl

fl.client.start_client(...,
                       grpc_max_message_length=1_073_741_824)


# and similarly on the server side:
fl.server.start_server(...,
                       grpc_max_message_length=1_073_741_824)                                     

One option to consider is whether you need to communicate the whole model. In some settings it might be enough to only federated the training/finetuning of a few layers of the model while the rest of the parameters remain frozen. Frozen parameters don’t need to be communicated.

You can see an example where we finetuned a ViT here: examples/vit-finetune. See how get_parameters() only returns the parameters of the output layer that’s being trained locally by the clients.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.