Skip to content

Latest commit

 

History

History
145 lines (106 loc) · 4.7 KB

File metadata and controls

145 lines (106 loc) · 4.7 KB
og:description:Beginner’s guide to running Flower quickstart examples with the Deployment Runtime using Docker Compose, showcasing its powerful federated learning capabilities.

Run Flower Quickstart Examples with Docker Compose

Flower provides a set of quickstart examples to help you get started with the framework. These examples are designed to demonstrate the capabilities of Flower and by default run using the Simulation Runtime. This guide demonstrates how to run them using Flower's Deployment Runtime via Docker Compose.

Important

Some quickstart examples may have limitations or requirements that prevent them from running on every environment. For more information, please see Limitations.

Prerequisites

Before you start, make sure that:

Run the Quickstart Example

  1. Clone the quickstart example you like to run. For example, quickstart-pytorch:

    $ git clone --depth=1 https://github.com/adap/flower.git \
         && mv flower/examples/quickstart-pytorch . \
         && rm -rf flower && cd quickstart-pytorch
  2. Download the compose.yml file into the example directory:

    $ curl https://raw.githubusercontent.com/adap/flower/refs/tags/v|stable_flwr_version|/framework/docker/complete/compose.yml \
        -o compose.yml
  3. Export the version of Flower that your environment uses. Then, build and start the services using the following command:

    $ export FLWR_VERSION="|stable_flwr_version|" # update with your version
    $ docker compose up --build -d
  1. Locate the Flower Configuration TOML file in your machine.

    $ flwr config list
    
    Flower Config file: /path/to/.flwr/config.toml
    SuperLink connections:
      supergrid
      local (default)
  2. Add a new SuperLink connection to your config.toml file and save it:

    [superlink.local-deployment]
    address = "127.0.0.1:9093"
    insecure = true

    Note

    You can customize the string that follows superlink. to fit your needs. However, please note that the string cannot contain a dot (.).

    In this example, local-deployment has been used. Just remember to replace local-deployment with your chosen name in both the superlink. string and the corresponding flwr run . command. Refer to the Flower Configuration for more information.

  3. Run the example and follow the logs of the ServerApp :

    $ flwr run . local-deployment --stream

That is all it takes! You can monitor the progress of the run through the logs of the ServerApp.

Run a Different Quickstart Example

To run a different quickstart example, such as quickstart-tensorflow, first, shut down the Docker Compose services of the current example:

$ docker compose down

After that, you can repeat the steps above.

Limitations

Quickstart Example Limitations
quickstart-fastai None
quickstart-huggingface None
quickstart-jax None
quickstart-mlcube The example has not yet been updated to work with the latest flwr version.
quickstart-mlx Requires to run on macOS with Apple Silicon.
quickstart-monai None
quickstart-pandas None
quickstart-pytorch-lightning Requires an older pip version that is not supported by the Flower Docker images.
quickstart-pytorch None
quickstart-sklearn None
quickstart-tensorflow None