Skip to content

Commit

Permalink
Merge branch 'main' into fix-fds-api-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tanertopal authored Oct 9, 2023
2 parents edbd9c2 + 908d539 commit 4be661e
Show file tree
Hide file tree
Showing 279 changed files with 755 additions and 361 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Build docs
run: ./dev/build-docs.sh
- name: Deploy docs
if: github.ref == 'refs/heads/main' && github.repository == 'adap/flower' && ${{ !github.event.pull_request.head.repo.fork }}
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork }}
env:
AWS_DEFAULT_REGION: ${{ secrets. AWS_DEFAULT_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Test wheel
run: ./dev/test-wheel.sh
- name: Upload wheel
if: github.repository == 'adap/flower' && ${{ !github.event.pull_request.head.repo.fork }}
if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork }}
id: upload
env:
AWS_DEFAULT_REGION: ${{ secrets. AWS_DEFAULT_REGION }}
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
- name: Install dependencies
run: python -m poetry install
- name: Install Flower wheel from artifact store
if: github.repository == 'adap/flower' && ${{ !github.event.pull_request.head.repo.fork }}
if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork }}
run: |
python -m pip install https://artifact.flower.dev/py/${{ github.head_ref }}/${{ needs.wheel.outputs.short_sha }}/${{ needs.wheel.outputs.whl_path }}
- name: Download dataset
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
run: |
python -m poetry install
- name: Install Flower wheel from artifact store
if: github.repository == 'adap/flower' && ${{ !github.event.pull_request.head.repo.fork }}
if: ${{ github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork }}
run: |
python -m pip install https://artifact.flower.dev/py/${{ github.head_ref }}/${{ needs.wheel.outputs.short_sha }}/${{ needs.wheel.outputs.whl_path }}
- name: Cache Datasets
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

deploy_docs:
needs: "build_docs"
if: github.ref == 'refs/heads/main' && github.repository == 'adap/flower' && ${{ !github.event.pull_request.head.repo.fork }}
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'adap/flower' && !github.event.pull_request.head.repo.fork }}
runs-on: macos-latest
name: Deploy docs
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ node_modules

# Flower Examples
examples/**/dataset/**
examples/**/dev/*.sh
#examples/**/dev/*.sh

# Flower Baselines
baselines/datasets/leaf
Expand Down
4 changes: 2 additions & 2 deletions baselines/doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,7 +32,7 @@
# -- Project information -----------------------------------------------------

project = "Flower"
copyright = "2022 Adap GmbH"
copyright = "2022 Flower Labs GmbH"
author = "The Flower Authors"

# The full version, including alpha/beta/rc tags
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/aws-ami-bootstrap-tf.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/aws-ami-bootstrap-torch.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2022 Adap GmbH. All Rights Reserved.
# Copyright 2022 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/check-protos.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/deploy-docs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/deploy-swift-docs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/publish-nightly.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion dev/publish.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright 2022 Adap GmbH. All Rights Reserved.
# Copyright 2022 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
7 changes: 7 additions & 0 deletions dev/test-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ if [ -z "$(python -m pyroma ./ | grep 'Final rating: 10/10')" ]; then
fi
echo "Pyroma wheel check: done"

echo "Check-wheel-content wheel check: start"
# The ignore W002 is "Wheel contains duplicate files"
# It is required because of the autogenerated proto files
# There is no file-based ignore for this tool
check-wheel-contents ./dist/ --ignore W002
echo "Check-wheel-content wheel check: done"

echo "- All wheel checks passed"
2 changes: 1 addition & 1 deletion doc/locales/fr/LC_MESSAGES/sphinx.po
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2022 Adap GmbH
# Copyright (C) 2022 Flower Labs GmbH
# This file is distributed under the same license as the Flower package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2023.
#
Expand Down
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -81,7 +81,7 @@
# -- Project information -----------------------------------------------------

project = "Flower"
copyright = "2022 Adap GmbH"
copyright = "2022 Flower Labs GmbH"
author = "The Flower Authors"

# The full version, including alpha/beta/rc tags
Expand Down
8 changes: 6 additions & 2 deletions doc/source/ref-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

### What's new?

- **Fix the incorrect return types of Strategy** ([#2432](https://github.com/adap/flower/pull/2432/files))

The types of the return values in the docstrings in two methods (`aggregate_fit` and `aggregate_evaluate`) now match the hint types in the code.

- **Unify client API** ([#2303](https://github.com/adap/flower/pull/2303))

Using the `client_fn`, Flower clients can interchangeably run as standalone processes (i.e. via `start_client`) or in simulation (i.e. via `start_simulation`) without requiring changes to how the client class is defined and instantiated.
Expand All @@ -16,9 +20,9 @@

- FedProx ([#2210](https://github.com/adap/flower/pull/2210), [#2286](https://github.com/adap/flower/pull/2286))

- **Update Flower Examples** ([#2384](https://github.com/adap/flower/pull/2384))
- **Update Flower Examples** ([#2384](https://github.com/adap/flower/pull/2384)), ([#2425](https://github.com/adap/flower/pull/2425))

- **General updates to baselines** ([#2301](https://github.com/adap/flower/pull/2301).[#2305](https://github.com/adap/flower/pull/2305), [#2307](https://github.com/adap/flower/pull/2307), [#2327](https://github.com/adap/flower/pull/2327))
- **General updates to baselines** ([#2301](https://github.com/adap/flower/pull/2301), [#2305](https://github.com/adap/flower/pull/2305), [#2307](https://github.com/adap/flower/pull/2307), [#2327](https://github.com/adap/flower/pull/2327))

- **General updates to the simulation engine** ([#2331](https://github.com/adap/flower/pull/2331), [#2448](https://github.com/adap/flower/pull/2448))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Adap GmbH. All Rights Reserved.
// Copyright 2020 Flower Labs GmbH. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion examples/android/client/app/src/main/proto/transport.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Adap GmbH. All Rights Reserved.
// Copyright 2020 Flower Labs GmbH. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions examples/doc/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Adap GmbH. All Rights Reserved.
# Copyright 2020 Flower Labs GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@
# -- Project information -----------------------------------------------------

project = "Flower"
copyright = "2022 Adap GmbH"
copyright = "2022 Flower Labs GmbH"
author = "The Flower Authors"

# The full version, including alpha/beta/rc tags
Expand Down
14 changes: 7 additions & 7 deletions examples/quickstart-huggingface/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ authors = [
]

[tool.poetry.dependencies]
python = "^3.8"
flwr = "^1.0.0"
torch = "^1.13.1"
transformers = "4.30.0"
datasets = "1.12.1"
evaluate = "0.4.0"
scikit-learn = "1.0"
python = ">=3.8,<3.11"
flwr = ">=1.0,<2.0"
torch = ">=1.13.1,<2.0"
transformers = ">=4.30.0,<5.0"
evaluate = ">=0.4.0,<1.0"
datasets = ">=2.0.0, <3.0"
scikit-learn = ">=1.3.1, <2.0"
12 changes: 6 additions & 6 deletions examples/quickstart-huggingface/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
datasets~=2.13.1
evaluate~=0.4.0
flwr~=1.4.0
numpy~=1.21.1
torch~=2.0.1
transformers~=4.30.2
flwr>=1.0, <2.0
torch>=1.13.1, <2.0
transformers>=4.30.0, <5.0
evaluate>=0.4.0, <1.0
datasets>=2.0.0, <3.0
scikit-learn>=1.3.1, <2.0
28 changes: 25 additions & 3 deletions examples/quickstart-mlcube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ Start by cloning the example project. We prepared a single-line command that you
git clone --depth=1 https://github.com/adap/flower.git && mv flower/examples/quickstart-mlcube . && rm -rf flower && cd quickstart-mlcube
```

Project dependencies (such as `tensorflow` and `flwr`) are defined in `pyproject.toml`. We recommend [Poetry](https://python-poetry.org/docs/) to install those dependencies and manage your virtual environment ([Poetry installation](https://python-poetry.org/docs/#installation)), but feel free to use a different way of installing dependencies and managing virtual environments if you have other preferences.
### Installing Dependencies

Project dependencies (such as `tensorflow` and `flwr`) are defined in `pyproject.toml` and `requirements.txt`. We recommend [Poetry](https://python-poetry.org/docs/) to install those dependencies and manage your virtual environment ([Poetry installation](https://python-poetry.org/docs/#installation)) or [pip](https://pip.pypa.io/en/latest/development/), but feel free to use a different way of installing dependencies and managing virtual environments if you have other preferences.

#### Poetry

```shell
poetry install
Expand All @@ -23,11 +27,29 @@ Poetry will install all your dependencies in a newly created virtual environment
poetry run python3 -c "import flwr"
```

For the MLCube setup you will need to install Docker on your system. Please refer to the [Docker install guide](https://docs.docker.com/get-docker/) on how to do that.
If you don't see any errors, you're good to go!

#### pip

Write the command below in your terminal to install the dependencies according to the configuration file requirements.txt.

```shell
pip install -r requirements.txt
```

To verify that everything works correctly, you can run the following command:

```shell
python3 -c "import flwr"
```

If you don't see any errors, you're good to go!

## MLCube setup
#### Docker

For the MLCube setup you will need to install Docker on your system. Please refer to the [Docker install guide](https://docs.docker.com/get-docker/) on how to do that.

#### MLCube

For the MLCube setup, we have prepared a script that you can execute in your shell using:

Expand Down
18 changes: 18 additions & 0 deletions examples/quickstart-mlcube/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:22.04
LABEL author="The Flower Authors"

RUN apt-get update && \
# install Python
apt-get install -y python3 python3-distutils curl && \
update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
curl -sSL -O https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py && \
rm get-pip.py && \
# clean apt cache
rm -rf /var/lib/apt/lists/*

COPY requirements.txt /requirements.txt
RUN pip3 install --no-cache-dir -r /requirements.txt

COPY mnist.py /workspace/mnist.py
ENTRYPOINT ["python3", "/workspace/mnist.py"]
19 changes: 19 additions & 0 deletions examples/quickstart-mlcube/dev/all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -e
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../

# Cleanup & prepare mlcube
./dev/setup.sh

# Start server
./dev/server.sh &
sleep 2 # Sleep for 2s to give the server enough time to start

for i in `seq 0 1`; do
./dev/client.sh $i &
done

# This will allow you to use CTRL+C to stop all background processes
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
# Wait for all background processes to complete
wait
11 changes: 11 additions & 0 deletions examples/quickstart-mlcube/dev/client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../

if [ $# -eq 0 ]
then
echo "Please provide the name of the client workspace e.g. 'python client.py one'"
exit 1
fi

poetry run python client.py $1
Loading

0 comments on commit 4be661e

Please sign in to comment.