Do you have a new federated learning paper and want to add a new baseline to Flower? Or do you want to add an experiment to an existing baseline paper? Great, we really appreciate your contribution.
The goal of Flower Baselines is to reproduce experiments from popular papers to accelerate researchers by enabling faster comparisons to new strategies, datasets, models, and federated pipelines in general.
Before you start to work on a new baseline or experiment, please check the Flower Issues or Flower Pull Requests to see if someone else is already working on it. Please open a new issue if you are planning to work on a new baseline or experiment with a short description of the corresponding paper and the experiment you want to contribute.
Contributing a new baseline is really easy. You only have to make sure that your federated learning experiments are running with Flower and replicate the results of a paper. Flower baselines need to make use of:
Poetry to manage the Python environment.
Hydra to manage the configuration files for your experiments.
You can find more information about how to setup Poetry in your machine in the
EXTENDED_README.md that is generated when you prepare your baseline.
Add a new Flower Baseline#
The instructions below are a more verbose version of what’s present in the Baselines README on GitHub.
Let’s say you want to contribute the code of your most recent Federated Learning publication, FedAwesome. There are only three steps necessary to create a new FedAwesome Flower Baseline:
- Get the Flower source code on your machine
Fork the Flower codebase: go to the Flower GitHub repo and fork the code (click the Fork button in the top-right corner and follow the instructions)
Clone the (forked) Flower source code:
git clone firstname.lastname@example.org:[your_github_username]/flower.git
Open the code in your favorite editor.
- Use the provided script to create your baseline directory
Navigate to the baselines directory and run
A new directory in
Follow the instructions in
README.mdin your baseline directory.
- Open a pull request
Stage your changes:
git add .
Commit & push:
git commit -m "Create new FedAwesome baseline" ; git push
Open a pull request: go to your fork of the Flower codebase and create a pull request that targets the Flower
Interact with the Flower maintainers during the merging process and make adjustments to your code as needed.
Flower is known and loved for its usability. Therefore, make sure that your baseline or experiment can be executed with a single command such as:
poetry run python -m <your-baseline>.main # or, once sourced into your environment python -m <your-baseline>.main
We provide you with a template-baseline to use as guidance when contributing your baseline. Having all baselines follow a homogenous structure helps users to tryout many baselines without the overheads of having to understand each individual codebase. Similarly, by using Hydra throughout, users will immediately know how to parameterise your experiments directly from the command line.
We look forward to your contribution!