flwr-nightly 1.4.0.dev20230321__tar.gz → 1.4.0.dev20230323__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/PKG-INFO +1 -1
  2. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/pyproject.toml +6 -6
  3. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/setup.py +6 -7
  4. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/__init__.py +2 -1
  5. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/app.py +12 -2
  6. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/rest_client/connection.py +7 -1
  7. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/app.py +11 -2
  8. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/rest_server/rest_api.py +11 -5
  9. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedxgb_nn_avg.py +0 -3
  10. flwr_nightly-1.4.0.dev20230321/src/py/flwr/server/strategy/fedxgb.py +0 -153
  11. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/LICENSE +0 -0
  12. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/README.md +0 -0
  13. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/__init__.py +0 -0
  14. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/client.py +0 -0
  15. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/dpfedavg_numpy_client.py +0 -0
  16. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/grpc_client/__init__.py +0 -0
  17. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/grpc_client/connection.py +0 -0
  18. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/message_handler/__init__.py +0 -0
  19. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/message_handler/message_handler.py +0 -0
  20. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/message_handler/task_handler.py +0 -0
  21. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/numpy_client.py +0 -0
  22. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/client/rest_client/__init__.py +0 -0
  23. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/__init__.py +0 -0
  24. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/date.py +0 -0
  25. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/dp.py +0 -0
  26. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/grpc.py +0 -0
  27. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/logger.py +0 -0
  28. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/parameter.py +0 -0
  29. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/serde.py +0 -0
  30. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/telemetry.py +0 -0
  31. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/typing.py +0 -0
  32. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/common/version.py +0 -0
  33. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/driver/__init__.py +0 -0
  34. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/driver/driver.py +0 -0
  35. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/__init__.py +0 -0
  36. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/driver_pb2.py +0 -0
  37. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/driver_pb2.pyi +0 -0
  38. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/driver_pb2_grpc.py +0 -0
  39. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/driver_pb2_grpc.pyi +0 -0
  40. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/fleet_pb2.py +0 -0
  41. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/fleet_pb2.pyi +0 -0
  42. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/fleet_pb2_grpc.py +0 -0
  43. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/fleet_pb2_grpc.pyi +0 -0
  44. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/node_pb2.py +0 -0
  45. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/node_pb2.pyi +0 -0
  46. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/node_pb2_grpc.py +0 -0
  47. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/node_pb2_grpc.pyi +0 -0
  48. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/task_pb2.py +0 -0
  49. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/task_pb2.pyi +0 -0
  50. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/task_pb2_grpc.py +0 -0
  51. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/task_pb2_grpc.pyi +0 -0
  52. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/transport_pb2.py +0 -0
  53. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/transport_pb2.pyi +0 -0
  54. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/transport_pb2_grpc.py +0 -0
  55. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/proto/transport_pb2_grpc.pyi +0 -0
  56. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/py.typed +0 -0
  57. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/__init__.py +0 -0
  58. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/client_manager.py +0 -0
  59. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/client_proxy.py +0 -0
  60. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/criterion.py +0 -0
  61. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/driver/__init__.py +0 -0
  62. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/driver/driver_servicer.py +0 -0
  63. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/fleet/__init__.py +0 -0
  64. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/fleet/fleet_servicer.py +0 -0
  65. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/grpc_server/__init__.py +0 -0
  66. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/grpc_server/driver_client_manager.py +0 -0
  67. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/grpc_server/flower_service_servicer.py +0 -0
  68. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/grpc_server/grpc_bridge.py +0 -0
  69. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/grpc_server/grpc_client_proxy.py +0 -0
  70. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/grpc_server/grpc_server.py +0 -0
  71. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/grpc_server/ins_scheduler.py +0 -0
  72. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/history.py +0 -0
  73. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/rest_server/__init__.py +0 -0
  74. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/server.py +0 -0
  75. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/state/__init__.py +0 -0
  76. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/state/in_memory_state.py +0 -0
  77. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/state/sqlite_state.py +0 -0
  78. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/state/state.py +0 -0
  79. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/state/state_factory.py +0 -0
  80. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/__init__.py +0 -0
  81. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/aggregate.py +0 -0
  82. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/dpfedavg_adaptive.py +0 -0
  83. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/dpfedavg_fixed.py +0 -0
  84. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fault_tolerant_fedavg.py +0 -0
  85. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedadagrad.py +0 -0
  86. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedadam.py +0 -0
  87. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedavg.py +0 -0
  88. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedavg_android.py +0 -0
  89. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedavgm.py +0 -0
  90. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedmedian.py +0 -0
  91. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedopt.py +0 -0
  92. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedprox.py +0 -0
  93. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/fedyogi.py +0 -0
  94. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/krum.py +0 -0
  95. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/qfedavg.py +0 -0
  96. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/strategy/strategy.py +0 -0
  97. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/utils/__init__.py +0 -0
  98. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/utils/tensorboard.py +0 -0
  99. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/server/utils/validator.py +0 -0
  100. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/simulation/__init__.py +0 -0
  101. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/simulation/app.py +0 -0
  102. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/simulation/ray_transport/__init__.py +0 -0
  103. {flwr_nightly-1.4.0.dev20230321 → flwr_nightly-1.4.0.dev20230323}/src/py/flwr/simulation/ray_transport/ray_client_proxy.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.4.0.dev20230321
3
+ Version: 1.4.0.dev20230323
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.dev
6
6
  License: Apache-2.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.4.0-dev20230321"
7
+ version = "1.4.0-dev20230323"
8
8
  description = "Flower: A Friendly Federated Learning Framework"
9
9
  license = "Apache-2.0"
10
10
  authors = ["The Flower Authors <hello@flower.dev>"]
@@ -60,11 +60,11 @@ iterators = "^0.0.2"
60
60
  # Optional dependencies (VCE)
61
61
  ray = { extras = ["default"], version = "~2.3.0", optional = true }
62
62
  # Optional dependencies (REST transport layer)
63
- requests = "^2.28.2"
64
- fastapi = "^0.92.0"
65
- starlette = "^0.25.0"
66
- uvicorn = {extras = ["standard"], version = "^0.20.0"}
67
- # Optional dependencies (xgboost)
63
+ requests = { version = "^2.28.2", optional = true }
64
+ fastapi = { version = "^0.92.0", optional = true }
65
+ starlette = { version = "^0.25.0", optional = true }
66
+ uvicorn = { extras = ["standard"], version = "^0.20.0", optional = true }
67
+ # Optional dependency (xgboost)
68
68
  xgboost = { version = "^1.6.2", optional = true }
69
69
 
70
70
  [tool.poetry.extras]
@@ -31,14 +31,13 @@ install_requires = \
31
31
  ['grpcio>=1.43.0,<2.0.0,!=1.52.0',
32
32
  'iterators>=0.0.2,<0.0.3',
33
33
  'numpy>=1.21.0,<2.0.0',
34
- 'protobuf>=3.19.0,<4.0.0',
35
- 'starlette>=0.25.0,<0.26.0']
34
+ 'protobuf>=3.19.0,<4.0.0']
36
35
 
37
36
  extras_require = \
38
- {':extra == "rest"': ['requests>=2.28.2,<3.0.0',
39
- 'fastapi>=0.92.0,<0.93.0',
40
- 'uvicorn[standard]>=0.20.0,<0.21.0'],
41
- ':python_version < "3.8"': ['importlib-metadata>=4.0.0,<5.0.0'],
37
+ {':python_version < "3.8"': ['importlib-metadata>=4.0.0,<5.0.0'],
38
+ 'rest': ['requests>=2.28.2,<3.0.0',
39
+ 'fastapi>=0.92.0,<0.93.0',
40
+ 'uvicorn[standard]>=0.20.0,<0.21.0'],
42
41
  'simulation': ['ray[default]>=2.3.0,<2.4.0'],
43
42
  'xgboost': ['xgboost>=1.6.2,<2.0.0']}
44
43
 
@@ -50,7 +49,7 @@ entry_points = \
50
49
 
51
50
  setup_kwargs = {
52
51
  'name': 'flwr-nightly',
53
- 'version': '1.4.0.dev20230321',
52
+ 'version': '1.4.0.dev20230323',
54
53
  'description': 'Flower: A Friendly Federated Learning Framework',
55
54
  '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\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',
56
55
  'author': 'The Flower Authors',
@@ -16,10 +16,11 @@
16
16
 
17
17
  from flwr.common.version import package_version as _package_version
18
18
 
19
- from . import client, server, simulation
19
+ from . import client, common, server, simulation
20
20
 
21
21
  __all__ = [
22
22
  "client",
23
+ "common",
23
24
  "server",
24
25
  "simulation",
25
26
  ]
@@ -49,7 +49,6 @@ from .numpy_client import has_evaluate as numpyclient_has_evaluate
49
49
  from .numpy_client import has_fit as numpyclient_has_fit
50
50
  from .numpy_client import has_get_parameters as numpyclient_has_get_parameters
51
51
  from .numpy_client import has_get_properties as numpyclient_has_get_properties
52
- from .rest_client.connection import http_request_response
53
52
 
54
53
  EXCEPTION_MESSAGE_WRONG_RETURN_TYPE_FIT = """
55
54
  NumPyClient.fit did not return a tuple with 3 elements.
@@ -81,6 +80,7 @@ Example
81
80
  ClientLike = Union[Client, NumPyClient]
82
81
 
83
82
 
83
+ # pylint: disable=import-outside-toplevel
84
84
  def start_client(
85
85
  *,
86
86
  server_address: str,
@@ -138,7 +138,17 @@ def start_client(
138
138
  event(EventType.START_CLIENT_ENTER)
139
139
 
140
140
  # Use either gRPC bidirectional streaming or REST request/response
141
- connection = http_request_response if rest else grpc_connection
141
+ if rest:
142
+ try:
143
+ from .rest_client.connection import http_request_response
144
+ except ImportError as missing_dep:
145
+ raise ImportError(
146
+ "To use the REST API you must install the "
147
+ "extra dependencies by running `pip install flwr['rest']`."
148
+ ) from missing_dep
149
+ connection = http_request_response
150
+ else:
151
+ connection = grpc_connection
142
152
  while True:
143
153
  sleep_duration: int = 0
144
154
  with connection(
@@ -19,7 +19,13 @@ from contextlib import contextmanager
19
19
  from logging import ERROR, INFO, WARN
20
20
  from typing import Callable, Dict, Iterator, Optional, Tuple
21
21
 
22
- import requests
22
+ try:
23
+ import requests
24
+ except ImportError as missing_dep:
25
+ raise ImportError(
26
+ "To use the REST API you must install the "
27
+ "extra dependencies by running `pip install flwr['rest']`."
28
+ ) from missing_dep
23
29
 
24
30
  from flwr.client.message_handler.task_handler import get_server_message
25
31
  from flwr.common import GRPC_MAX_MESSAGE_LENGTH
@@ -25,7 +25,6 @@ from types import FrameType
25
25
  from typing import List, Optional, Tuple
26
26
 
27
27
  import grpc
28
- import uvicorn
29
28
 
30
29
  from flwr.common import GRPC_MAX_MESSAGE_LENGTH, EventType, event
31
30
  from flwr.common.logger import log
@@ -40,7 +39,6 @@ from flwr.server.grpc_server.grpc_server import (
40
39
  start_grpc_server,
41
40
  )
42
41
  from flwr.server.history import History
43
- from flwr.server.rest_server.rest_api import app as fast_api_app
44
42
  from flwr.server.server import Server
45
43
  from flwr.server.state import StateFactory
46
44
  from flwr.server.strategy import FedAvg, Strategy
@@ -436,11 +434,22 @@ def _run_fleet_api_grpc_bidi(
436
434
  return fleet_grpc_server
437
435
 
438
436
 
437
+ # pylint: disable=import-outside-toplevel
439
438
  def _run_fleet_api_rest(
440
439
  address: str,
441
440
  state_factory: StateFactory,
442
441
  ) -> None:
443
442
  """Run Driver API (REST-based)."""
443
+ try:
444
+ import uvicorn
445
+
446
+ from flwr.server.rest_server.rest_api import app as fast_api_app
447
+ except ImportError as missing_dep:
448
+ raise ImportError(
449
+ "To use the REST API you must install the "
450
+ "extra dependencies by running "
451
+ "`pip install flwr['rest']`."
452
+ ) from missing_dep
444
453
  log(INFO, "Starting Flower REST server")
445
454
 
446
455
  # See: https://www.starlette.io/applications/#accessing-the-app-instance
@@ -19,8 +19,14 @@ from logging import INFO
19
19
  from typing import List, Optional
20
20
  from uuid import UUID
21
21
 
22
- from fastapi import FastAPI, HTTPException, Request, Response
23
- from starlette.datastructures import Headers
22
+ try:
23
+ from fastapi import FastAPI, HTTPException, Request, Response
24
+ from starlette.datastructures import Headers
25
+ except ImportError as missing_dep:
26
+ raise ImportError(
27
+ "To use the REST API you must install the "
28
+ "extra dependencies by running `pip install flwr['rest']`."
29
+ ) from missing_dep
24
30
 
25
31
  from flwr.common.logger import log
26
32
  from flwr.proto.fleet_pb2 import (
@@ -33,10 +39,10 @@ from flwr.proto.fleet_pb2 import (
33
39
  from flwr.proto.task_pb2 import TaskIns, TaskRes
34
40
  from flwr.server.state import State
35
41
 
36
- app = FastAPI()
42
+ app: FastAPI = FastAPI()
37
43
 
38
44
 
39
- @app.post("/api/v0/fleet/pull-task-ins", response_class=Response)
45
+ @app.post("/api/v0/fleet/pull-task-ins", response_class=Response) # type: ignore
40
46
  async def pull_task_ins(request: Request) -> Response:
41
47
  """Pull TaskIns."""
42
48
  _check_headers(request.headers)
@@ -72,7 +78,7 @@ async def pull_task_ins(request: Request) -> Response:
72
78
  )
73
79
 
74
80
 
75
- @app.post("/api/v0/fleet/push-task-res", response_class=Response)
81
+ @app.post("/api/v0/fleet/push-task-res", response_class=Response) # type: ignore
76
82
  async def push_task_res(request: Request) -> Response: # Check if token is needed here
77
83
  """Push TaskRes."""
78
84
  _check_headers(request.headers)
@@ -37,9 +37,6 @@ from flwr.server.client_proxy import ClientProxy
37
37
  from .aggregate import aggregate
38
38
  from .fedavg import FedAvg
39
39
 
40
- # from xgboost import XGBClassifier, XGBRegressor # pylint: disable=W0611
41
-
42
-
43
40
  WARNING_MIN_AVAILABLE_CLIENTS_TOO_LOW = """
44
41
  Setting `min_available_clients` lower than `min_fit_clients` or
45
42
  `min_evaluate_clients` can cause the server to fail when there are too few clients
@@ -1,153 +0,0 @@
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
- """Federated XGBoost utility functions."""
16
-
17
- from typing import Any, List, Optional, Tuple, Union
18
-
19
- import numpy as np
20
- import torch # pylint: disable=E0401
21
- import xgboost as xgb # pylint: disable=E0401
22
- from matplotlib import pyplot as plt # pylint: disable=E0401
23
- from torch.utils.data import DataLoader, Dataset # pylint: disable=E0401
24
- from xgboost import XGBClassifier, XGBRegressor # pylint: disable=E0401
25
-
26
- from flwr.common.typing import NDArray
27
-
28
-
29
- def plot_xgbtree(tree: Union[XGBClassifier, XGBRegressor], n_tree: int) -> None:
30
- """Visualize the built xgboost tree."""
31
- xgb.plot_tree(tree, num_trees=n_tree)
32
- plt.rcParams["figure.figsize"] = [50, 10]
33
- plt.show()
34
-
35
-
36
- def construct_tree(
37
- dataset: Dataset, label: NDArray, n_estimators: int, tree_type: str
38
- ) -> Union[XGBClassifier, XGBRegressor]:
39
- """Construct a xgboost tree form tabular dataset."""
40
- if tree_type == "BINARY":
41
- tree = xgb.XGBClassifier(
42
- objective="binary:logistic",
43
- learning_rate=0.1,
44
- max_depth=8,
45
- n_estimators=n_estimators,
46
- subsample=0.8,
47
- colsample_bylevel=1,
48
- colsample_bynode=1,
49
- colsample_bytree=1,
50
- alpha=5,
51
- gamma=5,
52
- num_parallel_tree=1,
53
- min_child_weight=1,
54
- )
55
-
56
- elif tree_type == "REG":
57
- tree = xgb.XGBRegressor(
58
- objective="reg:squarederror",
59
- learning_rate=0.1,
60
- max_depth=8,
61
- n_estimators=n_estimators,
62
- subsample=0.8,
63
- colsample_bylevel=1,
64
- colsample_bynode=1,
65
- colsample_bytree=1,
66
- alpha=5,
67
- gamma=5,
68
- num_parallel_tree=1,
69
- min_child_weight=1,
70
- )
71
-
72
- tree.fit(dataset, label)
73
- return tree
74
-
75
-
76
- def construct_tree_from_loader(
77
- dataset_loader: DataLoader, n_estimators: int, tree_type: str
78
- ) -> Union[XGBClassifier, XGBRegressor]:
79
- """Construct a xgboost tree form tabular dataset loader."""
80
- for dataset in dataset_loader:
81
- data, label = dataset[0], dataset[1]
82
- return construct_tree(data, label, n_estimators, tree_type)
83
-
84
-
85
- def single_tree_prediction(
86
- tree: Union[XGBClassifier, XGBRegressor], n_tree: int, dataset: NDArray
87
- ) -> Optional[NDArray]:
88
- """Extract the prediction result of a single tree in the xgboost tree
89
- ensemble."""
90
- # How to access a single tree
91
- # https://github.com/bmreiniger/datascience.stackexchange/blob/master/57905.ipynb
92
- num_t = len(tree.get_booster().get_dump())
93
- if n_tree > num_t:
94
- print(
95
- "The tree index to be extracted is larger than the total number of trees."
96
- )
97
- return None
98
-
99
- return tree.predict( # type: ignore
100
- dataset, iteration_range=(n_tree, n_tree + 1), output_margin=True
101
- )
102
-
103
-
104
- def tree_encoding( # pylint: disable=R0914
105
- trainloader: DataLoader,
106
- client_trees: Union[
107
- Tuple[XGBClassifier, int],
108
- Tuple[XGBRegressor, int],
109
- List[Union[Tuple[XGBClassifier, int], Tuple[XGBRegressor, int]]],
110
- ],
111
- client_tree_num: int,
112
- client_num: int,
113
- ) -> Optional[Tuple[NDArray, NDArray]]:
114
- """Transform the tabular dataset into prediction results using the
115
- aggregated xgboost tree ensembles from all clients."""
116
- if trainloader is None:
117
- return None
118
-
119
- for local_dataset in trainloader:
120
- x_train, y_train = local_dataset[0], local_dataset[1]
121
-
122
- x_train_enc = np.zeros((x_train.shape[0], client_num * client_tree_num))
123
- x_train_enc = np.array(x_train_enc, copy=True)
124
-
125
- temp_trees: Any = None
126
- if isinstance(client_trees, list) is False:
127
- temp_trees = [client_trees[0]] * client_num
128
- elif isinstance(client_trees, list) and len(client_trees) != client_num:
129
- temp_trees = [client_trees[0][0]] * client_num
130
- else:
131
- cids = []
132
- temp_trees = []
133
- for i, _ in enumerate(client_trees):
134
- temp_trees.append(client_trees[i][0]) # type: ignore
135
- cids.append(client_trees[i][1]) # type: ignore
136
- sorted_index = np.argsort(np.asarray(cids))
137
- temp_trees = np.asarray(temp_trees)[sorted_index]
138
-
139
- for i, _ in enumerate(temp_trees):
140
- for j in range(client_tree_num):
141
- x_train_enc[:, i * client_tree_num + j] = single_tree_prediction(
142
- temp_trees[i], j, x_train
143
- )
144
-
145
- x_train_enc32: Any = np.float32(x_train_enc)
146
- y_train32: Any = np.float32(y_train)
147
-
148
- x_train_enc32, y_train32 = torch.from_numpy(
149
- np.expand_dims(x_train_enc32, axis=1) # type: ignore
150
- ), torch.from_numpy(
151
- np.expand_dims(y_train32, axis=-1) # type: ignore
152
- )
153
- return x_train_enc32, y_train32