flwr-nightly 1.5.0.dev20230608__tar.gz → 1.5.0.dev20230615__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/PKG-INFO +1 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/pyproject.toml +5 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/setup.py +1 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/app.py +0 -3
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/client.py +0 -4
- flwr_nightly-1.5.0.dev20230615/src/py/flwr/client/dpfedavg_numpy_client.py +180 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/grpc_rere_client/connection.py +0 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/message_handler/task_handler.py +0 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/numpy_client.py +1 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/rest_client/connection.py +0 -3
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/address.py +1 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/dp.py +1 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/grpc.py +0 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/logger.py +0 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/serde.py +0 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/driver/driver.py +0 -3
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/driver/driver_client_manager.py +9 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/driver/driver_client_proxy.py +1 -1
- flwr_nightly-1.5.0.dev20230615/src/py/flwr/proto/task_pb2.py +148 -0
- flwr_nightly-1.5.0.dev20230615/src/py/flwr/proto/task_pb2.pyi +231 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/app.py +4 -11
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/client_manager.py +7 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/client_proxy.py +1 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/criterion.py +1 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_bidi/flower_service_servicer.py +3 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_bidi/grpc_bridge.py +1 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_bidi/grpc_client_proxy.py +1 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_bidi/grpc_server.py +1 -3
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_bidi/ins_scheduler.py +0 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/message_handler/message_handler.py +0 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/history.py +15 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/server.py +0 -5
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/state/in_memory_state.py +8 -5
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/state/sqlite_state.py +4 -5
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/state/state.py +2 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/state/state_factory.py +0 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/dpfedavg_adaptive.py +1 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/dpfedavg_fixed.py +46 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedadagrad.py +4 -4
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedadam.py +3 -4
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedavg.py +1 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedavg_android.py +1 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedopt.py +1 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedxgb_nn_avg.py +2 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedyogi.py +3 -4
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/qfedavg.py +1 -2
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/utils/tensorboard.py +2 -4
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/utils/validator.py +0 -1
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/simulation/app.py +4 -5
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/simulation/ray_transport/ray_client_proxy.py +13 -13
- flwr_nightly-1.5.0.dev20230608/src/py/flwr/client/dpfedavg_numpy_client.py +0 -83
- flwr_nightly-1.5.0.dev20230608/src/py/flwr/proto/task_pb2.py +0 -60
- flwr_nightly-1.5.0.dev20230608/src/py/flwr/proto/task_pb2.pyi +0 -96
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/LICENSE +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/README.md +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/grpc_client/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/grpc_client/connection.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/grpc_rere_client/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/message_handler/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/message_handler/message_handler.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/rest_client/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/constant.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/date.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/parameter.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/telemetry.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/typing.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/version.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/driver/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/driver/app.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/driver_pb2.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/driver_pb2.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/driver_pb2_grpc.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/driver_pb2_grpc.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/fleet_pb2.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/fleet_pb2.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/fleet_pb2_grpc.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/fleet_pb2_grpc.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/node_pb2.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/node_pb2.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/node_pb2_grpc.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/node_pb2_grpc.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/task_pb2_grpc.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/task_pb2_grpc.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/transport_pb2.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/transport_pb2.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/transport_pb2_grpc.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/proto/transport_pb2_grpc.pyi +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/py.typed +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/driver/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/driver/driver_servicer.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_bidi/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_bidi/driver_client_manager.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_rere/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/grpc_rere/fleet_servicer.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/message_handler/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/rest_rere/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/fleet/rest_rere/rest_api.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/state/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/aggregate.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fault_tolerant_fedavg.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedavgm.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedmedian.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedprox.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/fedtrimmedavg.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/krum.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/strategy/strategy.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/server/utils/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/simulation/__init__.py +0 -0
- {flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/simulation/ray_transport/__init__.py +0 -0
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
4
4
|
|
5
5
|
[tool.poetry]
|
6
6
|
name = "flwr-nightly"
|
7
|
-
version = "1.5.0-
|
7
|
+
version = "1.5.0-dev20230615"
|
8
8
|
description = "Flower: A Friendly Federated Learning Framework"
|
9
9
|
license = "Apache-2.0"
|
10
10
|
authors = ["The Flower Authors <hello@flower.dev>"]
|
@@ -152,3 +152,7 @@ disallow_untyped_calls = false
|
|
152
152
|
module = "torch.*"
|
153
153
|
follow_imports = "skip"
|
154
154
|
follow_imports_for_stubs = true
|
155
|
+
|
156
|
+
[tool.docformatter]
|
157
|
+
wrap-summaries = 88
|
158
|
+
wrap-descriptions = 88
|
@@ -52,7 +52,7 @@ entry_points = \
|
|
52
52
|
|
53
53
|
setup_kwargs = {
|
54
54
|
'name': 'flwr-nightly',
|
55
|
-
'version': '1.5.0.
|
55
|
+
'version': '1.5.0.dev20230615',
|
56
56
|
'description': 'Flower: A Friendly Federated Learning Framework',
|
57
57
|
'long_description': '# Flower: A Friendly Federated Learning Framework\n\n<p align="center">\n <a href="https://flower.dev/">\n <img src="https://flower.dev/_next/image/?url=%2F_next%2Fstatic%2Fmedia%2Fflower_white_border.c2012e70.png&w=640&q=75" width="140px" alt="Flower Website" />\n </a>\n</p>\n<p align="center">\n <a href="https://flower.dev/">Website</a> |\n <a href="https://flower.dev/blog">Blog</a> |\n <a href="https://flower.dev/docs/">Docs</a> |\n <a href="https://flower.dev/conf/flower-summit-2022">Conference</a> |\n <a href="https://flower.dev/join-slack">Slack</a>\n <br /><br />\n</p>\n\n[![GitHub license](https://img.shields.io/github/license/adap/flower)](https://github.com/adap/flower/blob/main/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/adap/flower/blob/main/CONTRIBUTING.md)\n![Build](https://github.com/adap/flower/actions/workflows/flower.yml/badge.svg)\n![Downloads](https://pepy.tech/badge/flwr)\n[![Slack](https://img.shields.io/badge/Chat-Slack-red)](https://flower.dev/join-slack)\n\nFlower (`flwr`) is a framework for building federated learning systems. The\ndesign of Flower is based on a few guiding principles:\n\n* **Customizable**: Federated learning systems vary wildly from one use case to\n another. Flower allows for a wide range of different configurations depending\n on the needs of each individual use case.\n\n* **Extendable**: Flower originated from a research project at the University of\n Oxford, so it was built with AI research in mind. Many components can be\n extended and overridden to build new state-of-the-art systems.\n\n* **Framework-agnostic**: Different machine learning frameworks have different\n strengths. Flower can be used with any machine learning framework, for\n example, [PyTorch](https://pytorch.org),\n [TensorFlow](https://tensorflow.org), [Hugging Face Transformers](https://huggingface.co/), [PyTorch Lightning](https://pytorchlightning.ai/), [MXNet](https://mxnet.apache.org/), [scikit-learn](https://scikit-learn.org/), [JAX](https://jax.readthedocs.io/), [TFLite](https://tensorflow.org/lite/), [fastai](https://www.fast.ai/), [Pandas](https://pandas.pydata.org/\n) for federated analytics, or even raw [NumPy](https://numpy.org/)\n for users who enjoy computing gradients by hand.\n\n* **Understandable**: Flower is written with maintainability in mind. The\n community is encouraged to both read and contribute to the codebase.\n\nMeet the Flower community on [flower.dev](https://flower.dev)!\n\n## Federated Learning Tutorial\n\nFlower\'s goal is to make federated learning accessible to everyone. This series of tutorials introduces the fundamentals of federated learning and how to implement them in Flower.\n\n0. **What is Federated Learning?**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-0-What-is-FL.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-0-What-is-FL.ipynb))\n\n1. **An Introduction to Federated Learning**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-1-Intro-to-FL-PyTorch.ipynb))\n\n2. **Using Strategies in Federated Learning**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-2-Strategies-in-FL-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-2-Strategies-in-FL-PyTorch.ipynb))\n \n3. **Building Strategies for Federated Learning**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-3-Building-a-Strategy-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-3-Building-a-Strategy-PyTorch.ipynb))\n \n4. **Custom Clients for Federated Learning**\n\n [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/adap/flower/blob/main/doc/source/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.ipynb) (or open the [Jupyter Notebook](https://github.com/adap/flower/blob/main/doc/source/tutorial/Flower-4-Client-and-NumPyClient-PyTorch.ipynb))\n\nStay tuned, more tutorials are coming soon. Topics include **Privacy and Security in Federated Learning**, and **Scaling Federated Learning**.\n\n## Documentation\n\n[Flower Docs](https://flower.dev/docs):\n* [Installation](https://flower.dev/docs/installation.html)\n* [Quickstart (TensorFlow)](https://flower.dev/docs/quickstart-tensorflow.html)\n* [Quickstart (PyTorch)](https://flower.dev/docs/quickstart-pytorch.html)\n* [Quickstart (Hugging Face [code example])](https://flower.dev/docs/quickstart-huggingface.html)\n* [Quickstart (PyTorch Lightning [code example])](https://flower.dev/docs/quickstart-pytorch-lightning.html)\n* [Quickstart (MXNet)](https://flower.dev/docs/example-mxnet-walk-through.html)\n* [Quickstart (Pandas)](https://flower.dev/docs/quickstart-pandas.html)\n* [Quickstart (fastai)](https://flower.dev/docs/quickstart-fastai.html)\n* [Quickstart (JAX)](https://github.com/adap/flower/tree/main/examples/quickstart_jax)\n* [Quickstart (scikit-learn)](https://github.com/adap/flower/tree/main/examples/sklearn-logreg-mnist)\n* [Quickstart (TFLite on Android [code example])](https://github.com/adap/flower/tree/main/examples/android)\n* [Quickstart (iOS)](https://flower.dev/docs/quickstart-ios.html)\n\n## Flower Baselines\n\nFlower Baselines is a collection of community-contributed experiments that reproduce the experiments performed in popular federated learning publications. Researchers can build on Flower Baselines to quickly evaluate new ideas:\n\n* [FedAvg](https://arxiv.org/abs/1602.05629):\n * [MNIST](https://github.com/adap/flower/tree/main/baselines/flwr_baselines/publications/fedavg_mnist)\n* [FedProx](https://arxiv.org/abs/1812.06127):\n * [MNIST](https://github.com/adap/flower/tree/main/baselines/flwr_baselines/publications/fedprox_mnist)\n* [FedBN: Federated Learning on non-IID Features via Local Batch Normalization](https://arxiv.org/abs/2102.07623):\n * [Convergence Rate](https://github.com/adap/flower/tree/main/baselines/flwr_baselines/publications/fedbn/convergence_rate)\n* [Adaptive Federated Optimization](https://arxiv.org/abs/2003.00295):\n * [CIFAR-10/100](https://github.com/adap/flower/tree/main/baselines/flwr_baselines/publications/adaptive_federated_optimization)\n\nCheck the Flower documentation to learn more: [Using Baselines](https://flower.dev/docs/using-baselines.html)\n\nThe Flower community loves contributions! Make your work more visible and enable others to build on it by contributing it as a baseline: [Contributing Baselines](https://flower.dev/docs/contributing-baselines.html)\n\n## Flower Usage Examples\n\nSeveral code examples show different usage scenarios of Flower (in combination with popular machine learning frameworks such as PyTorch or TensorFlow).\n\nQuickstart examples:\n\n* [Quickstart (TensorFlow)](https://github.com/adap/flower/tree/main/examples/quickstart_tensorflow)\n* [Quickstart (PyTorch)](https://github.com/adap/flower/tree/main/examples/quickstart_pytorch)\n* [Quickstart (Hugging Face)](https://github.com/adap/flower/tree/main/examples/quickstart_huggingface)\n* [Quickstart (PyTorch Lightning)](https://github.com/adap/flower/tree/main/examples/quickstart_pytorch_lightning)\n* [Quickstart (fastai)](https://github.com/adap/flower/tree/main/examples/quickstart_fastai)\n* [Quickstart (Pandas)](https://github.com/adap/flower/tree/main/examples/quickstart_pandas)\n* [Quickstart (MXNet)](https://github.com/adap/flower/tree/main/examples/quickstart_mxnet)\n* [Quickstart (JAX)](https://github.com/adap/flower/tree/main/examples/quickstart_jax)\n* [Quickstart (scikit-learn)](https://github.com/adap/flower/tree/main/examples/sklearn-logreg-mnist)\n* [Quickstart (TFLite on Android)](https://github.com/adap/flower/tree/main/examples/android)\n\nOther [examples](https://github.com/adap/flower/tree/main/examples):\n\n* [Raspberry Pi & Nvidia Jetson Tutorial](https://github.com/adap/flower/tree/main/examples/embedded_devices)\n* [Android & TFLite](https://github.com/adap/flower/tree/main/examples/android)\n* [PyTorch: From Centralized to Federated](https://github.com/adap/flower/tree/main/examples/pytorch_from_centralized_to_federated)\n* [MXNet: From Centralized to Federated](https://github.com/adap/flower/tree/main/examples/mxnet_from_centralized_to_federated)\n* [Advanced Flower with TensorFlow/Keras](https://github.com/adap/flower/tree/main/examples/advanced_tensorflow)\n* [Advanced Flower with PyTorch](https://github.com/adap/flower/tree/main/examples/advanced_pytorch)\n* Single-Machine Simulation of Federated Learning Systems ([PyTorch](https://github.com/adap/flower/tree/main/examples/simulation_pytorch)) ([Tensorflow](https://github.com/adap/flower/tree/main/examples/simulation_tensorflow))\n\n## Community\n\nFlower is built by a wonderful community of researchers and engineers. [Join Slack](https://flower.dev/join-slack) to meet them, [contributions](#contributing-to-flower) are welcome.\n\n<a href="https://github.com/adap/flower/graphs/contributors">\n <img src="https://contrib.rocks/image?repo=adap/flower" />\n</a>\n\n## Citation\n\nIf you publish work that uses Flower, please cite Flower as follows: \n\n```bibtex\n@article{beutel2020flower,\n title={Flower: A Friendly Federated Learning Research Framework},\n author={Beutel, Daniel J and Topal, Taner and Mathur, Akhil and Qiu, Xinchi and Fernandez-Marques, Javier and Gao, Yan and Sani, Lorenzo and Kwing, Hei Li and Parcollet, Titouan and Gusmão, Pedro PB de and Lane, Nicholas D}, \n journal={arXiv preprint arXiv:2007.14390},\n year={2020}\n}\n```\n\nPlease also consider adding your publication to the list of Flower-based publications in the docs, just open a Pull Request.\n\n## Contributing to Flower\n\nWe welcome contributions. Please see [CONTRIBUTING.md](CONTRIBUTING.md) to get started!\n',
|
58
58
|
'author': 'The Flower Authors',
|
@@ -150,7 +150,6 @@ def start_client(
|
|
150
150
|
>>> root_certificates=Path("/crts/root.pem").read_bytes(),
|
151
151
|
>>> )
|
152
152
|
"""
|
153
|
-
|
154
153
|
event(EventType.START_CLIENT_ENTER)
|
155
154
|
|
156
155
|
# Parse IP address
|
@@ -278,7 +277,6 @@ def start_numpy_client(
|
|
278
277
|
>>> root_certificates=Path("/crts/root.pem").read_bytes(),
|
279
278
|
>>> )
|
280
279
|
"""
|
281
|
-
|
282
280
|
# Start
|
283
281
|
start_client(
|
284
282
|
server_address=server_address,
|
@@ -321,7 +319,6 @@ def _get_parameters(self: Client, ins: GetParametersIns) -> GetParametersRes:
|
|
321
319
|
|
322
320
|
def _fit(self: Client, ins: FitIns) -> FitRes:
|
323
321
|
"""Refine the provided parameters using the locally held dataset."""
|
324
|
-
|
325
322
|
# Deconstruct FitIns
|
326
323
|
parameters: NDArrays = parameters_to_ndarrays(ins.parameters)
|
327
324
|
|
{flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/client.py
RENAMED
@@ -161,7 +161,6 @@ def maybe_call_get_properties(
|
|
161
161
|
client: Client, get_properties_ins: GetPropertiesIns
|
162
162
|
) -> GetPropertiesRes:
|
163
163
|
"""Call `get_properties` if the client overrides it."""
|
164
|
-
|
165
164
|
# Check if client overrides `get_properties`
|
166
165
|
if not has_get_properties(client=client):
|
167
166
|
# If client does not override `get_properties`, don't call it
|
@@ -182,7 +181,6 @@ def maybe_call_get_parameters(
|
|
182
181
|
client: Client, get_parameters_ins: GetParametersIns
|
183
182
|
) -> GetParametersRes:
|
184
183
|
"""Call `get_parameters` if the client overrides it."""
|
185
|
-
|
186
184
|
# Check if client overrides `get_parameters`
|
187
185
|
if not has_get_parameters(client=client):
|
188
186
|
# If client does not override `get_parameters`, don't call it
|
@@ -201,7 +199,6 @@ def maybe_call_get_parameters(
|
|
201
199
|
|
202
200
|
def maybe_call_fit(client: Client, fit_ins: FitIns) -> FitRes:
|
203
201
|
"""Call `fit` if the client overrides it."""
|
204
|
-
|
205
202
|
# Check if client overrides `fit`
|
206
203
|
if not has_fit(client=client):
|
207
204
|
# If client does not override `fit`, don't call it
|
@@ -222,7 +219,6 @@ def maybe_call_fit(client: Client, fit_ins: FitIns) -> FitRes:
|
|
222
219
|
|
223
220
|
def maybe_call_evaluate(client: Client, evaluate_ins: EvaluateIns) -> EvaluateRes:
|
224
221
|
"""Call `evaluate` if the client overrides it."""
|
225
|
-
|
226
222
|
# Check if client overrides `evaluate`
|
227
223
|
if not has_evaluate(client=client):
|
228
224
|
# If client does not override `evaluate`, don't call it
|
@@ -0,0 +1,180 @@
|
|
1
|
+
# Copyright 2020 Adap GmbH. All Rights Reserved.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
# ==============================================================================
|
15
|
+
"""Wrapper for configuring a Flower client for DP."""
|
16
|
+
|
17
|
+
|
18
|
+
import copy
|
19
|
+
from typing import Dict, Tuple
|
20
|
+
|
21
|
+
import numpy as np
|
22
|
+
|
23
|
+
from flwr.client.numpy_client import NumPyClient
|
24
|
+
from flwr.common.dp import add_gaussian_noise, clip_by_l2
|
25
|
+
from flwr.common.typing import Config, NDArrays, Scalar
|
26
|
+
|
27
|
+
|
28
|
+
class DPFedAvgNumPyClient(NumPyClient):
|
29
|
+
"""Wrapper for configuring a Flower client for DP."""
|
30
|
+
|
31
|
+
def __init__(self, client: NumPyClient) -> None:
|
32
|
+
super().__init__()
|
33
|
+
self.client = client
|
34
|
+
|
35
|
+
def get_properties(self, config: Config) -> Dict[str, Scalar]:
|
36
|
+
"""Get client properties using the given Numpy client.
|
37
|
+
|
38
|
+
Parameters
|
39
|
+
----------
|
40
|
+
config : Config
|
41
|
+
Configuration parameters requested by the server.
|
42
|
+
This can be used to tell the client which properties
|
43
|
+
are needed along with some Scalar attributes.
|
44
|
+
|
45
|
+
Returns
|
46
|
+
-------
|
47
|
+
properties : Dict[str, Scalar]
|
48
|
+
A dictionary mapping arbitrary string keys to values of type
|
49
|
+
bool, bytes, float, int, or str. It can be used to communicate
|
50
|
+
arbitrary property values back to the server.
|
51
|
+
"""
|
52
|
+
return self.client.get_properties(config)
|
53
|
+
|
54
|
+
def get_parameters(self, config: Dict[str, Scalar]) -> NDArrays:
|
55
|
+
"""Return the current local model parameters.
|
56
|
+
|
57
|
+
Parameters
|
58
|
+
----------
|
59
|
+
config : Config
|
60
|
+
Configuration parameters requested by the server.
|
61
|
+
This can be used to tell the client which parameters
|
62
|
+
are needed along with some Scalar attributes.
|
63
|
+
|
64
|
+
Returns
|
65
|
+
-------
|
66
|
+
parameters : NDArrays
|
67
|
+
The local model parameters as a list of NumPy ndarrays.
|
68
|
+
"""
|
69
|
+
return self.client.get_parameters(config)
|
70
|
+
|
71
|
+
def fit(
|
72
|
+
self, parameters: NDArrays, config: Dict[str, Scalar]
|
73
|
+
) -> Tuple[NDArrays, int, Dict[str, Scalar]]:
|
74
|
+
"""Train the provided parameters using the locally held dataset.
|
75
|
+
|
76
|
+
This method first updates the local model using the original parameters
|
77
|
+
provided. It then calculates the update by subtracting the original
|
78
|
+
parameters from the updated model. The update is then clipped by an L2
|
79
|
+
norm and Gaussian noise is added if specified by the configuration.
|
80
|
+
|
81
|
+
The update is then applied to the original parameters to obtain the
|
82
|
+
updated parameters which are returned along with the number of examples
|
83
|
+
used and metrics computed during the fitting process.
|
84
|
+
|
85
|
+
Parameters
|
86
|
+
----------
|
87
|
+
parameters : NDArrays
|
88
|
+
The current (global) model parameters.
|
89
|
+
config : Dict[str, Scalar]
|
90
|
+
Configuration parameters which allow the
|
91
|
+
server to influence training on the client. It can be used to
|
92
|
+
communicate arbitrary values from the server to the client, for
|
93
|
+
example, to set the number of (local) training epochs.
|
94
|
+
|
95
|
+
Returns
|
96
|
+
-------
|
97
|
+
parameters : NDArrays
|
98
|
+
The locally updated model parameters.
|
99
|
+
num_examples : int
|
100
|
+
The number of examples used for training.
|
101
|
+
metrics : Dict[str, Scalar]
|
102
|
+
A dictionary mapping arbitrary string keys to values of type
|
103
|
+
bool, bytes, float, int, or str. It can be used to communicate
|
104
|
+
arbitrary values back to the server.
|
105
|
+
|
106
|
+
Raises
|
107
|
+
------
|
108
|
+
Exception
|
109
|
+
If any required configuration parameters are not provided or are of
|
110
|
+
the wrong type.
|
111
|
+
"""
|
112
|
+
original_params = copy.deepcopy(parameters)
|
113
|
+
# Getting the updated model from the wrapped client
|
114
|
+
updated_params, num_examples, metrics = self.client.fit(parameters, config)
|
115
|
+
|
116
|
+
# Update = updated model - original model
|
117
|
+
update = [np.subtract(x, y) for (x, y) in zip(updated_params, original_params)]
|
118
|
+
|
119
|
+
if "dpfedavg_clip_norm" not in config:
|
120
|
+
raise Exception("Clipping threshold not supplied by the server.")
|
121
|
+
if not isinstance(config["dpfedavg_clip_norm"], float):
|
122
|
+
raise Exception("Clipping threshold should be a floating point value.")
|
123
|
+
|
124
|
+
# Clipping
|
125
|
+
update, clipped = clip_by_l2(update, config["dpfedavg_clip_norm"])
|
126
|
+
|
127
|
+
if "dpfedavg_noise_stddev" in config:
|
128
|
+
if not isinstance(config["dpfedavg_noise_stddev"], float):
|
129
|
+
raise Exception(
|
130
|
+
"Scale of noise to be added should be a floating point value."
|
131
|
+
)
|
132
|
+
# Noising
|
133
|
+
update = add_gaussian_noise(update, config["dpfedavg_noise_stddev"])
|
134
|
+
|
135
|
+
for i, _ in enumerate(original_params):
|
136
|
+
updated_params[i] = original_params[i] + update[i]
|
137
|
+
|
138
|
+
# Calculating value of norm indicator bit, required for adaptive clipping
|
139
|
+
if "dpfedavg_adaptive_clip_enabled" in config:
|
140
|
+
if not isinstance(config["dpfedavg_adaptive_clip_enabled"], bool):
|
141
|
+
raise Exception(
|
142
|
+
"dpfedavg_adaptive_clip_enabled should be a boolean-valued flag."
|
143
|
+
)
|
144
|
+
metrics["dpfedavg_norm_bit"] = not clipped
|
145
|
+
|
146
|
+
return updated_params, num_examples, metrics
|
147
|
+
|
148
|
+
def evaluate(
|
149
|
+
self, parameters: NDArrays, config: Dict[str, Scalar]
|
150
|
+
) -> Tuple[float, int, Dict[str, Scalar]]:
|
151
|
+
"""Evaluate the provided parameters using the locally held dataset.
|
152
|
+
|
153
|
+
Parameters
|
154
|
+
----------
|
155
|
+
parameters : NDArrays
|
156
|
+
The current (global) model parameters.
|
157
|
+
config : Dict[str, Scalar]
|
158
|
+
Configuration parameters which allow the server to influence
|
159
|
+
evaluation on the client. It can be used to communicate
|
160
|
+
arbitrary values from the server to the client, for example,
|
161
|
+
to influence the number of examples used for evaluation.
|
162
|
+
|
163
|
+
Returns
|
164
|
+
-------
|
165
|
+
loss : float
|
166
|
+
The evaluation loss of the model on the local dataset.
|
167
|
+
num_examples : int
|
168
|
+
The number of examples used for evaluation.
|
169
|
+
metrics : Dict[str, Scalar]
|
170
|
+
A dictionary mapping arbitrary string keys to values of
|
171
|
+
type bool, bytes, float, int, or str. It can be used to
|
172
|
+
communicate arbitrary values back to the server.
|
173
|
+
|
174
|
+
Warning
|
175
|
+
-------
|
176
|
+
The previous return type format (int, float, float) and the
|
177
|
+
extended format (int, float, float, Dict[str, Scalar]) have been
|
178
|
+
deprecated and removed since Flower 0.19.
|
179
|
+
"""
|
180
|
+
return self.client.evaluate(parameters, config)
|
@@ -98,7 +98,6 @@ def grpc_request_response(
|
|
98
98
|
|
99
99
|
def receive() -> Optional[ServerMessage]:
|
100
100
|
"""Receive next task from server."""
|
101
|
-
|
102
101
|
# Request instructions (task) from server
|
103
102
|
request = PullTaskInsRequest(
|
104
103
|
node=Node(node_id=0, anonymous=True),
|
@@ -121,7 +120,6 @@ def grpc_request_response(
|
|
121
120
|
|
122
121
|
def send(client_message_proto: ClientMessage) -> None:
|
123
122
|
"""Send task result back to server."""
|
124
|
-
|
125
123
|
if state[KEY_TASK_INS] is None:
|
126
124
|
log(ERROR, "No current TaskIns")
|
127
125
|
return
|
@@ -26,7 +26,6 @@ def get_server_message(
|
|
26
26
|
pull_task_ins_response: PullTaskInsResponse,
|
27
27
|
) -> Optional[Tuple[TaskIns, ServerMessage]]:
|
28
28
|
"""Get the first ServerMessage, if available."""
|
29
|
-
|
30
29
|
# Extract a single ServerMessage from the response, if possible
|
31
30
|
if len(pull_task_ins_response.task_ins_list) == 0:
|
32
31
|
return None
|
{flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/client/numpy_client.py
RENAMED
@@ -25,7 +25,7 @@ class NumPyClient(ABC):
|
|
25
25
|
"""Abstract base class for Flower clients using NumPy."""
|
26
26
|
|
27
27
|
def get_properties(self, config: Config) -> Dict[str, Scalar]:
|
28
|
-
"""
|
28
|
+
"""Return a client's set of properties.
|
29
29
|
|
30
30
|
Parameters
|
31
31
|
----------
|
@@ -79,7 +79,6 @@ def http_request_response(
|
|
79
79
|
-------
|
80
80
|
receive, send : Callable, Callable
|
81
81
|
"""
|
82
|
-
|
83
82
|
log(
|
84
83
|
WARN,
|
85
84
|
"""
|
@@ -113,7 +112,6 @@ def http_request_response(
|
|
113
112
|
|
114
113
|
def receive() -> Optional[ServerMessage]:
|
115
114
|
"""Receive next task from server."""
|
116
|
-
|
117
115
|
# Serialize ProtoBuf to bytes
|
118
116
|
pull_task_ins_req_proto = PullTaskInsRequest(
|
119
117
|
node=Node(node_id=0, anonymous=True),
|
@@ -170,7 +168,6 @@ def http_request_response(
|
|
170
168
|
|
171
169
|
def send(client_message_proto: ClientMessage) -> None:
|
172
170
|
"""Send task result back to server."""
|
173
|
-
|
174
171
|
if state[KEY_TASK_INS] is None:
|
175
172
|
log(ERROR, "No current TaskIns")
|
176
173
|
return
|
@@ -31,8 +31,7 @@ def _get_update_norm(update: NDArrays) -> float:
|
|
31
31
|
|
32
32
|
|
33
33
|
def add_gaussian_noise(update: NDArrays, std_dev: float) -> NDArrays:
|
34
|
-
"""
|
35
|
-
point value in the update."""
|
34
|
+
"""Add iid Gaussian noise to each floating point value in the update."""
|
36
35
|
update_noised = [
|
37
36
|
layer + np.random.normal(0, std_dev, layer.shape) for layer in update
|
38
37
|
]
|
{flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/grpc.py
RENAMED
@@ -31,7 +31,6 @@ def create_channel(
|
|
31
31
|
max_message_length: int = GRPC_MAX_MESSAGE_LENGTH,
|
32
32
|
) -> grpc.Channel:
|
33
33
|
"""Create a gRPC channel, either secure or insecure."""
|
34
|
-
|
35
34
|
# Possible options:
|
36
35
|
# https://github.com/grpc/grpc/blob/v1.43.x/include/grpc/impl/codegen/grpc_types.h
|
37
36
|
channel_options = [
|
{flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/common/logger.py
RENAMED
@@ -70,7 +70,6 @@ def configure(
|
|
70
70
|
identifier: str, filename: Optional[str] = None, host: Optional[str] = None
|
71
71
|
) -> None:
|
72
72
|
"""Configure logging to file and/or remote log server."""
|
73
|
-
|
74
73
|
# Create formatter
|
75
74
|
string_to_input = f"{identifier} | %(levelname)s %(name)s %(asctime)s "
|
76
75
|
string_to_input += "| %(filename)s:%(lineno)d | %(message)s"
|
{flwr_nightly-1.5.0.dev20230608 → flwr_nightly-1.5.0.dev20230615}/src/py/flwr/driver/driver.py
RENAMED
@@ -75,7 +75,6 @@ class Driver:
|
|
75
75
|
|
76
76
|
def get_nodes(self, req: driver_pb2.GetNodesRequest) -> driver_pb2.GetNodesResponse:
|
77
77
|
"""Get client IDs."""
|
78
|
-
|
79
78
|
# Check if channel is open
|
80
79
|
if self.stub is None:
|
81
80
|
log(ERROR, ERROR_MESSAGE_DRIVER_NOT_CONNECTED)
|
@@ -89,7 +88,6 @@ class Driver:
|
|
89
88
|
self, req: driver_pb2.PushTaskInsRequest
|
90
89
|
) -> driver_pb2.PushTaskInsResponse:
|
91
90
|
"""Schedule tasks."""
|
92
|
-
|
93
91
|
# Check if channel is open
|
94
92
|
if self.stub is None:
|
95
93
|
log(ERROR, ERROR_MESSAGE_DRIVER_NOT_CONNECTED)
|
@@ -103,7 +101,6 @@ class Driver:
|
|
103
101
|
self, req: driver_pb2.PullTaskResRequest
|
104
102
|
) -> driver_pb2.PullTaskResResponse:
|
105
103
|
"""Get task results."""
|
106
|
-
|
107
104
|
# Check if channel is open
|
108
105
|
if self.stub is None:
|
109
106
|
log(ERROR, ERROR_MESSAGE_DRIVER_NOT_CONNECTED)
|
@@ -85,10 +85,12 @@ class DriverClientManager(ClientManager):
|
|
85
85
|
raise NotImplementedError("DriverClientManager.unregister is not implemented")
|
86
86
|
|
87
87
|
def all(self) -> Dict[str, ClientProxy]:
|
88
|
+
"""Return all available clients."""
|
88
89
|
self._update_nodes()
|
89
90
|
return self.clients
|
90
91
|
|
91
92
|
def wait_for(self, num_clients: int, timeout: int = 86400) -> bool:
|
93
|
+
"""Wait until at least `num_clients` are available."""
|
92
94
|
start_time = time.time()
|
93
95
|
while time.time() < start_time + timeout:
|
94
96
|
self._update_nodes()
|
@@ -103,6 +105,7 @@ class DriverClientManager(ClientManager):
|
|
103
105
|
min_num_clients: Optional[int] = None,
|
104
106
|
criterion: Optional[Criterion] = None,
|
105
107
|
) -> List[ClientProxy]:
|
108
|
+
"""Sample a number of Flower ClientProxy instances."""
|
106
109
|
if min_num_clients is None:
|
107
110
|
min_num_clients = num_clients
|
108
111
|
self.wait_for(min_num_clients)
|
@@ -128,6 +131,12 @@ class DriverClientManager(ClientManager):
|
|
128
131
|
return [self.clients[cid] for cid in sampled_cids]
|
129
132
|
|
130
133
|
def _update_nodes(self) -> None:
|
134
|
+
"""Update the nodes list in the client manager.
|
135
|
+
|
136
|
+
This method communicates with the associated driver to get all node ids. Each
|
137
|
+
node id is then converted into a `DriverClientProxy` instance and stored in the
|
138
|
+
`clients` dictionary with node id as key.
|
139
|
+
"""
|
131
140
|
get_nodes_res = self.driver.get_nodes(req=driver_pb2.GetNodesRequest())
|
132
141
|
all_node_ids = get_nodes_res.node_ids
|
133
142
|
for node_id in all_node_ids:
|
@@ -40,7 +40,7 @@ class DriverClientProxy(ClientProxy):
|
|
40
40
|
def get_properties(
|
41
41
|
self, ins: common.GetPropertiesIns, timeout: Optional[float]
|
42
42
|
) -> common.GetPropertiesRes:
|
43
|
-
"""
|
43
|
+
"""Return client's properties."""
|
44
44
|
server_message_proto: transport_pb2.ServerMessage = (
|
45
45
|
serde.server_message_to_proto(
|
46
46
|
server_message=common.ServerMessage(get_properties_ins=ins)
|
@@ -0,0 +1,148 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: flwr/proto/task.proto
|
4
|
+
"""Generated protocol buffer code."""
|
5
|
+
from google.protobuf import descriptor as _descriptor
|
6
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
7
|
+
from google.protobuf import message as _message
|
8
|
+
from google.protobuf import reflection as _reflection
|
9
|
+
from google.protobuf import symbol_database as _symbol_database
|
10
|
+
# @@protoc_insertion_point(imports)
|
11
|
+
|
12
|
+
_sym_db = _symbol_database.Default()
|
13
|
+
|
14
|
+
|
15
|
+
from flwr.proto import node_pb2 as flwr_dot_proto_dot_node__pb2
|
16
|
+
from flwr.proto import transport_pb2 as flwr_dot_proto_dot_transport__pb2
|
17
|
+
|
18
|
+
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x66lwr/proto/task.proto\x12\nflwr.proto\x1a\x15\x66lwr/proto/node.proto\x1a\x1a\x66lwr/proto/transport.proto\"\xbe\x02\n\x04Task\x12\"\n\x08producer\x18\x01 \x01(\x0b\x32\x10.flwr.proto.Node\x12\"\n\x08\x63onsumer\x18\x02 \x01(\x0b\x32\x10.flwr.proto.Node\x12\x12\n\ncreated_at\x18\x03 \x01(\t\x12\x14\n\x0c\x64\x65livered_at\x18\x04 \x01(\t\x12\x0b\n\x03ttl\x18\x05 \x01(\t\x12\x10\n\x08\x61ncestry\x18\x06 \x03(\t\x12)\n\x02sa\x18\x07 \x01(\x0b\x32\x1d.flwr.proto.SecureAggregation\x12<\n\x15legacy_server_message\x18\x65 \x01(\x0b\x32\x19.flwr.proto.ServerMessageB\x02\x18\x01\x12<\n\x15legacy_client_message\x18\x66 \x01(\x0b\x32\x19.flwr.proto.ClientMessageB\x02\x18\x01\"a\n\x07TaskIns\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x10\n\x08group_id\x18\x02 \x01(\t\x12\x13\n\x0bworkload_id\x18\x03 \x01(\t\x12\x1e\n\x04task\x18\x04 \x01(\x0b\x32\x10.flwr.proto.Task\"a\n\x07TaskRes\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x10\n\x08group_id\x18\x02 \x01(\t\x12\x13\n\x0bworkload_id\x18\x03 \x01(\t\x12\x1e\n\x04task\x18\x04 \x01(\x0b\x32\x10.flwr.proto.Task\"\xf3\x03\n\x05Value\x12\x10\n\x06\x64ouble\x18\x01 \x01(\x01H\x00\x12\x10\n\x06sint64\x18\x02 \x01(\x12H\x00\x12\x0e\n\x04\x62ool\x18\x03 \x01(\x08H\x00\x12\x10\n\x06string\x18\x04 \x01(\tH\x00\x12\x0f\n\x05\x62ytes\x18\x05 \x01(\x0cH\x00\x12\x33\n\x0b\x64ouble_list\x18\x15 \x01(\x0b\x32\x1c.flwr.proto.Value.DoubleListH\x00\x12\x33\n\x0bsint64_list\x18\x16 \x01(\x0b\x32\x1c.flwr.proto.Value.Sint64ListH\x00\x12/\n\tbool_list\x18\x17 \x01(\x0b\x32\x1a.flwr.proto.Value.BoolListH\x00\x12\x33\n\x0bstring_list\x18\x18 \x01(\x0b\x32\x1c.flwr.proto.Value.StringListH\x00\x12\x31\n\nbytes_list\x18\x19 \x01(\x0b\x32\x1b.flwr.proto.Value.BytesListH\x00\x1a\x1a\n\nDoubleList\x12\x0c\n\x04vals\x18\x01 \x03(\x01\x1a\x1a\n\nSint64List\x12\x0c\n\x04vals\x18\x01 \x03(\x12\x1a\x18\n\x08\x42oolList\x12\x0c\n\x04vals\x18\x01 \x03(\x08\x1a\x1a\n\nStringList\x12\x0c\n\x04vals\x18\x01 \x03(\t\x1a\x19\n\tBytesList\x12\x0c\n\x04vals\x18\x01 \x03(\x0c\x42\x07\n\x05value\"\xa0\x01\n\x11SecureAggregation\x12\x44\n\x0cnamed_values\x18\x01 \x03(\x0b\x32..flwr.proto.SecureAggregation.NamedValuesEntry\x1a\x45\n\x10NamedValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.flwr.proto.Value:\x02\x38\x01\x62\x06proto3')
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
_TASK = DESCRIPTOR.message_types_by_name['Task']
|
24
|
+
_TASKINS = DESCRIPTOR.message_types_by_name['TaskIns']
|
25
|
+
_TASKRES = DESCRIPTOR.message_types_by_name['TaskRes']
|
26
|
+
_VALUE = DESCRIPTOR.message_types_by_name['Value']
|
27
|
+
_VALUE_DOUBLELIST = _VALUE.nested_types_by_name['DoubleList']
|
28
|
+
_VALUE_SINT64LIST = _VALUE.nested_types_by_name['Sint64List']
|
29
|
+
_VALUE_BOOLLIST = _VALUE.nested_types_by_name['BoolList']
|
30
|
+
_VALUE_STRINGLIST = _VALUE.nested_types_by_name['StringList']
|
31
|
+
_VALUE_BYTESLIST = _VALUE.nested_types_by_name['BytesList']
|
32
|
+
_SECUREAGGREGATION = DESCRIPTOR.message_types_by_name['SecureAggregation']
|
33
|
+
_SECUREAGGREGATION_NAMEDVALUESENTRY = _SECUREAGGREGATION.nested_types_by_name['NamedValuesEntry']
|
34
|
+
Task = _reflection.GeneratedProtocolMessageType('Task', (_message.Message,), {
|
35
|
+
'DESCRIPTOR' : _TASK,
|
36
|
+
'__module__' : 'flwr.proto.task_pb2'
|
37
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.Task)
|
38
|
+
})
|
39
|
+
_sym_db.RegisterMessage(Task)
|
40
|
+
|
41
|
+
TaskIns = _reflection.GeneratedProtocolMessageType('TaskIns', (_message.Message,), {
|
42
|
+
'DESCRIPTOR' : _TASKINS,
|
43
|
+
'__module__' : 'flwr.proto.task_pb2'
|
44
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.TaskIns)
|
45
|
+
})
|
46
|
+
_sym_db.RegisterMessage(TaskIns)
|
47
|
+
|
48
|
+
TaskRes = _reflection.GeneratedProtocolMessageType('TaskRes', (_message.Message,), {
|
49
|
+
'DESCRIPTOR' : _TASKRES,
|
50
|
+
'__module__' : 'flwr.proto.task_pb2'
|
51
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.TaskRes)
|
52
|
+
})
|
53
|
+
_sym_db.RegisterMessage(TaskRes)
|
54
|
+
|
55
|
+
Value = _reflection.GeneratedProtocolMessageType('Value', (_message.Message,), {
|
56
|
+
|
57
|
+
'DoubleList' : _reflection.GeneratedProtocolMessageType('DoubleList', (_message.Message,), {
|
58
|
+
'DESCRIPTOR' : _VALUE_DOUBLELIST,
|
59
|
+
'__module__' : 'flwr.proto.task_pb2'
|
60
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.Value.DoubleList)
|
61
|
+
})
|
62
|
+
,
|
63
|
+
|
64
|
+
'Sint64List' : _reflection.GeneratedProtocolMessageType('Sint64List', (_message.Message,), {
|
65
|
+
'DESCRIPTOR' : _VALUE_SINT64LIST,
|
66
|
+
'__module__' : 'flwr.proto.task_pb2'
|
67
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.Value.Sint64List)
|
68
|
+
})
|
69
|
+
,
|
70
|
+
|
71
|
+
'BoolList' : _reflection.GeneratedProtocolMessageType('BoolList', (_message.Message,), {
|
72
|
+
'DESCRIPTOR' : _VALUE_BOOLLIST,
|
73
|
+
'__module__' : 'flwr.proto.task_pb2'
|
74
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.Value.BoolList)
|
75
|
+
})
|
76
|
+
,
|
77
|
+
|
78
|
+
'StringList' : _reflection.GeneratedProtocolMessageType('StringList', (_message.Message,), {
|
79
|
+
'DESCRIPTOR' : _VALUE_STRINGLIST,
|
80
|
+
'__module__' : 'flwr.proto.task_pb2'
|
81
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.Value.StringList)
|
82
|
+
})
|
83
|
+
,
|
84
|
+
|
85
|
+
'BytesList' : _reflection.GeneratedProtocolMessageType('BytesList', (_message.Message,), {
|
86
|
+
'DESCRIPTOR' : _VALUE_BYTESLIST,
|
87
|
+
'__module__' : 'flwr.proto.task_pb2'
|
88
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.Value.BytesList)
|
89
|
+
})
|
90
|
+
,
|
91
|
+
'DESCRIPTOR' : _VALUE,
|
92
|
+
'__module__' : 'flwr.proto.task_pb2'
|
93
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.Value)
|
94
|
+
})
|
95
|
+
_sym_db.RegisterMessage(Value)
|
96
|
+
_sym_db.RegisterMessage(Value.DoubleList)
|
97
|
+
_sym_db.RegisterMessage(Value.Sint64List)
|
98
|
+
_sym_db.RegisterMessage(Value.BoolList)
|
99
|
+
_sym_db.RegisterMessage(Value.StringList)
|
100
|
+
_sym_db.RegisterMessage(Value.BytesList)
|
101
|
+
|
102
|
+
SecureAggregation = _reflection.GeneratedProtocolMessageType('SecureAggregation', (_message.Message,), {
|
103
|
+
|
104
|
+
'NamedValuesEntry' : _reflection.GeneratedProtocolMessageType('NamedValuesEntry', (_message.Message,), {
|
105
|
+
'DESCRIPTOR' : _SECUREAGGREGATION_NAMEDVALUESENTRY,
|
106
|
+
'__module__' : 'flwr.proto.task_pb2'
|
107
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.SecureAggregation.NamedValuesEntry)
|
108
|
+
})
|
109
|
+
,
|
110
|
+
'DESCRIPTOR' : _SECUREAGGREGATION,
|
111
|
+
'__module__' : 'flwr.proto.task_pb2'
|
112
|
+
# @@protoc_insertion_point(class_scope:flwr.proto.SecureAggregation)
|
113
|
+
})
|
114
|
+
_sym_db.RegisterMessage(SecureAggregation)
|
115
|
+
_sym_db.RegisterMessage(SecureAggregation.NamedValuesEntry)
|
116
|
+
|
117
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
118
|
+
|
119
|
+
DESCRIPTOR._options = None
|
120
|
+
_TASK.fields_by_name['legacy_server_message']._options = None
|
121
|
+
_TASK.fields_by_name['legacy_server_message']._serialized_options = b'\030\001'
|
122
|
+
_TASK.fields_by_name['legacy_client_message']._options = None
|
123
|
+
_TASK.fields_by_name['legacy_client_message']._serialized_options = b'\030\001'
|
124
|
+
_SECUREAGGREGATION_NAMEDVALUESENTRY._options = None
|
125
|
+
_SECUREAGGREGATION_NAMEDVALUESENTRY._serialized_options = b'8\001'
|
126
|
+
_TASK._serialized_start=89
|
127
|
+
_TASK._serialized_end=407
|
128
|
+
_TASKINS._serialized_start=409
|
129
|
+
_TASKINS._serialized_end=506
|
130
|
+
_TASKRES._serialized_start=508
|
131
|
+
_TASKRES._serialized_end=605
|
132
|
+
_VALUE._serialized_start=608
|
133
|
+
_VALUE._serialized_end=1107
|
134
|
+
_VALUE_DOUBLELIST._serialized_start=963
|
135
|
+
_VALUE_DOUBLELIST._serialized_end=989
|
136
|
+
_VALUE_SINT64LIST._serialized_start=991
|
137
|
+
_VALUE_SINT64LIST._serialized_end=1017
|
138
|
+
_VALUE_BOOLLIST._serialized_start=1019
|
139
|
+
_VALUE_BOOLLIST._serialized_end=1043
|
140
|
+
_VALUE_STRINGLIST._serialized_start=1045
|
141
|
+
_VALUE_STRINGLIST._serialized_end=1071
|
142
|
+
_VALUE_BYTESLIST._serialized_start=1073
|
143
|
+
_VALUE_BYTESLIST._serialized_end=1098
|
144
|
+
_SECUREAGGREGATION._serialized_start=1110
|
145
|
+
_SECUREAGGREGATION._serialized_end=1270
|
146
|
+
_SECUREAGGREGATION_NAMEDVALUESENTRY._serialized_start=1201
|
147
|
+
_SECUREAGGREGATION_NAMEDVALUESENTRY._serialized_end=1270
|
148
|
+
# @@protoc_insertion_point(module_scope)
|