Skip to content

Commit

Permalink
Merge branch 'main' into workloadstate-client-injection
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljanes authored Nov 29, 2023
2 parents 3b9819f + 02bb3ba commit b779204
Show file tree
Hide file tree
Showing 33 changed files with 222 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/framework-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
cat body.md
- name: Release
uses: softprops/action-gh-release@de2c0eb
uses: softprops/action-gh-release@v1
with:
body_path: ./body.md
draft: true
Expand Down
2 changes: 1 addition & 1 deletion baselines/doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
author = "The Flower Authors"

# The full version, including alpha/beta/rc tags
release = "1.6.0"
release = "1.7.0"


# -- General configuration ---------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions dev/add-shortlog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ set -e
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/../

tags=$(git tag --sort=-v:refname)
new_version=$(echo "$tags" | sed -n '1p')
old_version=$(echo "$tags" | sed -n '2p')
new_version=$1
old_version=$(echo "$tags" | sed -n '1p')

shortlog=$(git shortlog "$old_version".."$new_version" -s | grep -vEi '(\(|\[)bot(\)|\])' | awk '{name = substr($0, index($0, $2)); printf "%s`%s`", sep, name; sep=", "} END {print ""}')
shortlog=$(git shortlog "$old_version"..main -s | grep -vEi '(\(|\[)bot(\)|\])' | awk '{name = substr($0, index($0, $2)); printf "%s`%s`", sep, name; sep=", "} END {print ""}')

token="<!---TOKEN_$new_version-->"
thanks="\n### Thanks to our contributors\n\nWe would like to give our special thanks to all the contributors who made the new version of Flower possible (in \`git shortlog\` order):\n\n$shortlog $token"
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
author = "The Flower Authors"

# The full version, including alpha/beta/rc tags
release = "1.6.0"
release = "1.7.0"

# -- General configuration ---------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ Open a development version of the same notebook from branch `branch-name` by cha
Install a `whl` on Google Colab:

1. In the vertical icon grid on the left hand side, select ``Files`` > ``Upload to session storage``
2. Upload the whl (e.g., ``flwr-1.6.0-py3-none-any.whl``)
3. Change ``!pip install -q 'flwr[simulation]' torch torchvision matplotlib`` to ``!pip install -q 'flwr-1.6.0-py3-none-any.whl[simulation]' torch torchvision matplotlib``
2. Upload the whl (e.g., ``flwr-1.7.0-py3-none-any.whl``)
3. Change ``!pip install -q 'flwr[simulation]' torch torchvision matplotlib`` to ``!pip install -q 'flwr-1.7.0-py3-none-any.whl[simulation]' torch torchvision matplotlib``
2 changes: 1 addition & 1 deletion doc/source/contributor-how-to-release-flower.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Update the changelog (``changelog.md``) with all relevant changes that happened

`GitHub: Compare v1.2.0...main <https://github.com/adap/flower/compare/v1.2.0...main>`_

Thank the authors who contributed since the last release. This can be done by running the ``./dev/add-shortlog.sh`` convenience script (it can be ran multiple times and will update the names in the list if new contributors were added in the meantime).
Thank the authors who contributed since the last release. This can be done by running the ``./dev/add-shortlog.sh <new version>`` convenience script (it can be ran multiple times and will update the names in the list if new contributors were added in the meantime).

During the release
------------------
Expand Down
46 changes: 34 additions & 12 deletions doc/source/ref-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

## Unreleased

## v1.6.0 (2023-11-28)

### Thanks to our contributors

We would like to give our special thanks to all the contributors who made the new version of Flower possible (in `git shortlog` order):

`Aashish Kolluri`, `Adam Narozniak`, `Alessio Mora`, `Barathwaja S`, `Charles Beauville`, `Daniel J. Beutel`, `Daniel Nata Nugraha`, `Gabriel Mota`, `Heng Pan`, `Ivan Agarský`, `JS.KIM`, `Javier`, `Marius Schlegel`, `Navin Chandra`, `Nic Lane`, `Peterpan828`, `Qinbin Li`, `Shaz-hash`, `Steve Laskaridis`, `Taner Topal`, `William Lindskog`, `Yan Gao`, `cnxdeveloper`, `k3nfalt` <!---TOKEN_v1.6.0-->

### What's new?

- **Add experimental support for Python 3.12** ([#2565](https://github.com/adap/flower/pull/2565))

- **Add new XGBoost examples** ([#2612](https://github.com/adap/flower/pull/2612), [#2554](https://github.com/adap/flower/pull/2554), [#2617](https://github.com/adap/flower/pull/2617), [#2618](https://github.com/adap/flower/pull/2618), [#2619](https://github.com/adap/flower/pull/2619), [#2567](https://github.com/adap/flower/pull/2567))

We have added a new `xgboost-quickstart` example alongside a new `xgboost-comprehensive` example that goes more in-depth.

- **Add Vertical FL example** ([#2598](https://github.com/adap/flower/pull/2598))

We had many questions about Vertical Federated Learning using Flower, so we decided to add an simple example for it on the [Titanic dataset](https://www.kaggle.com/competitions/titanic/data) alongside a tutorial (in the README).
Expand All @@ -14,17 +26,29 @@

- **Update REST API to support create and delete nodes** ([#2283](https://github.com/adap/flower/pull/2283))

- **Update the C++ SDK** ([#2537](https://github/com/adap/flower/pull/2537), [#2528](https://github/com/adap/flower/pull/2528), [#2523](https://github.com/adap/flower/pull/2523), [#2522](https://github.com/adap/flower/pull/2522))
- **Update the Android SDK** ([#2187](https://github.com/adap/flower/pull/2187))

Add gRPC request-response capability to the Android SDK.

- **Update the C++ SDK** ([#2537](https://github.com/adap/flower/pull/2537), [#2528](https://github.com/adap/flower/pull/2528), [#2523](https://github.com/adap/flower/pull/2523), [#2522](https://github.com/adap/flower/pull/2522))

Add gRPC request-response capability to the C++ SDK.

- **Fix the incorrect return types of Strategy** ([#2432](https://github.com/adap/flower/pull/2432/files))
- **Make HTTPS the new default** ([#2591](https://github.com/adap/flower/pull/2591), [#2636](https://github.com/adap/flower/pull/2636))

Flower is moving to HTTPS by default. The new `flower-server` requires passing `--certificates`, but users can enable `--insecure` to use HTTP for prototyping. The same applies to `flower-client`, which can either use user-provided credentials or gRPC-bundled certificates to connect to an HTTPS-enabled server or requires opt-out via passing `--insecure` to enable insecure HTTP connections.

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.
For backward compatibility, `start_client()` and `start_numpy_client()` will still start in insecure mode by default. In a future release, insecure connections will require user opt-in by passing `insecure=True`.

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

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. Calling `start_numpy_client` is now deprecated.
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. The `to_client()` function is introduced to convert a `NumPyClient` to a `Client`.

- **Add new** `Bulyan` **strategy** ([#1817](https://github.com/adap/flower/pull/1817), [#1891](https://github.com/adap/flower/pull/1891))

The new `Bulyan` strategy implements Bulyan by [El Mhamdi et al., 2018](https://arxiv.org/abs/1802.07927)

- **Add new** `XGB Bagging` **strategy** ([#2611](https://github.com/adap/flower/pull/2611))

- **Introduce `WorkloadState`** ([#2564](https://github.com/adap/flower/pull/2564), [#2632](https://github.com/adap/flower/pull/2632))

Expand Down Expand Up @@ -54,19 +78,17 @@

- FedBN ([#2608](https://github.com/adap/flower/pull/2608), [#2615](https://github.com/adap/flower/pull/2615))

- **Update Flower Examples** ([#2384](https://github.com/adap/flower/pull/2384),[#2425](https://github.com/adap/flower/pull/2425), [#2526](https://github.com/adap/flower/pull/2526))
- **General updates to Flower Examples** ([#2384](https://github.com/adap/flower/pull/2384),[#2425](https://github.com/adap/flower/pull/2425), [#2526](https://github.com/adap/flower/pull/2526), [#2302](https://github.com/adap/flower/pull/2302), [#2545](https://github.com/adap/flower/pull/2545))

- **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), [#2435](https://github.com/adap/flower/pull/2435))
- **General updates to Flower 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), [#2435](https://github.com/adap/flower/pull/2435), [#2462](https://github.com/adap/flower/pull/2462), [#2463](https://github.com/adap/flower/pull/2463), [#2461](https://github.com/adap/flower/pull/2461), [#2469](https://github.com/adap/flower/pull/2469), [#2466](https://github.com/adap/flower/pull/2466), [#2471](https://github.com/adap/flower/pull/2471), [#2472](https://github.com/adap/flower/pull/2472), [#2470](https://github.com/adap/flower/pull/2470))

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

- **General improvements** ([#2309](https://github.com/adap/flower/pull/2309), [#2310](https://github.com/adap/flower/pull/2310), [2313](https://github.com/adap/flower/pull/2313), [#2316](https://github.com/adap/flower/pull/2316), [2317](https://github.com/adap/flower/pull/2317),[#2349](https://github.com/adap/flower/pull/2349), [#2360](https://github.com/adap/flower/pull/2360), [#2402](https://github.com/adap/flower/pull/2402), [#2446](https://github.com/adap/flower/pull/2446) [#2561](https://github.com/adap/flower/pull/2561))
- **General updates to Flower SDKs** ([#2288](https://github.com/adap/flower/pull/2288), [#2429](https://github.com/adap/flower/pull/2429), [#2555](https://github.com/adap/flower/pull/2555), [#2543](https://github.com/adap/flower/pull/2543), [#2544](https://github.com/adap/flower/pull/2544), [#2597](https://github.com/adap/flower/pull/2597), [#2623](https://github.com/adap/flower/pull/2623))

Flower received many improvements under the hood, too many to list here.

- **Add new** `Bulyan` **strategy** ([#1817](https://github.com/adap/flower/pull/1817), [#1891](https://github.com/adap/flower/pull/1891))
- **General improvements** ([#2309](https://github.com/adap/flower/pull/2309), [#2310](https://github.com/adap/flower/pull/2310), [2313](https://github.com/adap/flower/pull/2313), [#2316](https://github.com/adap/flower/pull/2316), [2317](https://github.com/adap/flower/pull/2317), [#2349](https://github.com/adap/flower/pull/2349), [#2360](https://github.com/adap/flower/pull/2360), [#2402](https://github.com/adap/flower/pull/2402), [#2446](https://github.com/adap/flower/pull/2446), [#2561](https://github.com/adap/flower/pull/2561), [#2273](https://github.com/adap/flower/pull/2273), [#2267](https://github.com/adap/flower/pull/2267), [#2274](https://github.com/adap/flower/pull/2274), [#2275](https://github.com/adap/flower/pull/2275), [#2432](https://github.com/adap/flower/pull/2432), [#2251](https://github.com/adap/flower/pull/2251), [#2321](https://github.com/adap/flower/pull/2321), [#1936](https://github.com/adap/flower/pull/1936), [#2408](https://github.com/adap/flower/pull/2408), [#2413](https://github.com/adap/flower/pull/2413), [#2401](https://github.com/adap/flower/pull/2401), [#2531](https://github.com/adap/flower/pull/2531), [#2534](https://github.com/adap/flower/pull/2534), [#2535](https://github.com/adap/flower/pull/2535), [#2521](https://github.com/adap/flower/pull/2521), [#2553](https://github.com/adap/flower/pull/2553), [#2596](https://github.com/adap/flower/pull/2596))

The new `Bulyan` strategy implements Bulyan by [El Mhamdi et al., 2018](https://arxiv.org/abs/1802.07927)
Flower received many improvements under the hood, too many to list here.

### Incompatible changes

Expand Down
6 changes: 5 additions & 1 deletion e2e/bare-https/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ def evaluate(self, parameters, config):
return loss, 1, {"accuracy": accuracy}

def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
# Start Flower client
fl.client.start_numpy_client(
server_address="127.0.0.1:8080",
client=FlowerClient(),
root_certificates=Path("certificates/ca.crt").read_bytes(),
insecure=False,
)
5 changes: 4 additions & 1 deletion e2e/bare/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ def evaluate(self, parameters, config):
return loss, 1, {"accuracy": accuracy}

def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
# Start Flower client
Expand Down
7 changes: 6 additions & 1 deletion e2e/fastai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ def evaluate(self, parameters, config):


def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()


flower = fl.flower.Flower(
client_fn=client_fn,
)


if __name__ == "__main__":
Expand Down
6 changes: 5 additions & 1 deletion e2e/jax/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ def evaluate(
return float(loss), num_examples, {"loss": float(loss)}

def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
# Start Flower client
Expand Down
6 changes: 5 additions & 1 deletion e2e/mxnet/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ def evaluate(self, parameters, config):


def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
# Start Flower client
Expand Down
6 changes: 5 additions & 1 deletion e2e/opacus/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ def evaluate(self, parameters, config):

def client_fn(cid):
model = Net()
return FlowerClient(model)
return FlowerClient(model).to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
fl.client.start_numpy_client(
Expand Down
6 changes: 5 additions & 1 deletion e2e/pandas/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def fit(
)

def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
# Start Flower client
Expand Down
6 changes: 5 additions & 1 deletion e2e/pytorch-lightning/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ def client_fn(cid):
train_loader, val_loader, test_loader = mnist.load_data()

# Flower client
return FlowerClient(model, train_loader, val_loader, test_loader)
return FlowerClient(model, train_loader, val_loader, test_loader).to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

def main() -> None:
# Model and data
Expand Down
6 changes: 5 additions & 1 deletion e2e/pytorch/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ def set_parameters(model, parameters):
return

def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)


if __name__ == "__main__":
Expand Down
6 changes: 5 additions & 1 deletion e2e/scikit-learn/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ def evaluate(self, parameters, config): # type: ignore
return loss, len(X_test), {"accuracy": accuracy}

def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
# Start Flower client
Expand Down
9 changes: 9 additions & 0 deletions e2e/strategies/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ def evaluate(self, parameters, config):
return loss, len(x_test), {"accuracy": accuracy}


def client_fn(cid):
return FlowerClient().to_client()


flower = fl.flower.Flower(
client_fn=client_fn,
)


if __name__ == "__main__":
# Start Flower client
fl.client.start_numpy_client(server_address="127.0.0.1:8080", client=FlowerClient())
6 changes: 5 additions & 1 deletion e2e/tabnet/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ def evaluate(self, parameters, config):


def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
# Start Flower client
Expand Down
6 changes: 5 additions & 1 deletion e2e/tensorflow/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def evaluate(self, parameters, config):
return loss, len(x_test), {"accuracy": accuracy}

def client_fn(cid):
return FlowerClient()
return FlowerClient().to_client()

flower = fl.flower.Flower(
client_fn=client_fn,
)

if __name__ == "__main__":
# Start Flower client
Expand Down
14 changes: 8 additions & 6 deletions e2e/test_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ set -e
case "$1" in
bare-https)
./generate.sh
cert_arg="--certificates certificates/ca.crt certificates/server.pem certificates/server.key"
server_arg="--certificates certificates/ca.crt certificates/server.pem certificates/server.key"
client_arg="--root-certificates certificates/ca.crt"
;;
*)
cert_arg="--insecure"
server_arg="--insecure"
client_arg="--insecure"
;;
esac

timeout 2m flower-server $cert_arg --grpc-bidi --grpc-bidi-fleet-api-address 0.0.0.0:8080 &
timeout 2m flower-server $server_arg &
sleep 3

python client.py &
timeout 2m flower-client $client_arg --callable client:flower --server 127.0.0.1:9092 &
sleep 3

python client.py &
timeout 2m flower-client $client_arg --callable client:flower --server 127.0.0.1:9092 &
sleep 3

timeout 2m python driver.py &
Expand All @@ -27,7 +29,7 @@ wait $pid
res=$?

if [[ "$res" = "0" ]];
then echo "Training worked correctly" && pkill python;
then echo "Training worked correctly" && pkill flower-client && pkill flower-server;
else echo "Training had an issue" && exit 1;
fi

2 changes: 1 addition & 1 deletion examples/doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
author = "The Flower Authors"

# The full version, including alpha/beta/rc tags
release = "1.6.0"
release = "1.7.0"


# -- General configuration ---------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions examples/vertical-fl/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ requires = ["poetry-core>=1.4.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "quickstart-pytorch"
name = "vertical-fl"
version = "0.1.0"
description = "PyTorch Federated Learning Quickstart with Flower"
description = "PyTorch Vertical FL with Flower"
authors = ["The Flower Authors <[email protected]>"]

[tool.poetry.dependencies]
python = ">=3.8,<3.11"
flwr = ">=1.0,<2.0"
flwr = { extras = ["simulation"], version = ">=1.0,<2.0" }
torch = "2.1.0"
matplotlib = "3.7.3"
scikit-learn = "1.3.2"
Expand Down
2 changes: 1 addition & 1 deletion examples/vertical-fl/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flwr>=1.0, <2.0
flwr[simulation]>=1.0, <2.0
torch==2.1.0
matplotlib==3.7.3
scikit-learn==1.3.2
Expand Down
Loading

0 comments on commit b779204

Please sign in to comment.