flwr 1.17.0__py3-none-any.whl → 1.18.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flwr/__init__.py +1 -1
- flwr/cli/__init__.py +1 -1
- flwr/cli/app.py +21 -2
- flwr/cli/build.py +1 -1
- flwr/cli/cli_user_auth_interceptor.py +1 -1
- flwr/cli/config_utils.py +53 -17
- flwr/cli/example.py +1 -1
- flwr/cli/install.py +1 -1
- flwr/cli/log.py +1 -1
- flwr/cli/login/__init__.py +1 -1
- flwr/cli/login/login.py +12 -1
- flwr/cli/ls.py +1 -1
- flwr/cli/new/__init__.py +1 -1
- flwr/cli/new/new.py +4 -4
- flwr/cli/new/templates/__init__.py +1 -1
- flwr/cli/new/templates/app/__init__.py +1 -1
- flwr/cli/new/templates/app/code/__init__.py +1 -1
- flwr/cli/new/templates/app/code/flwr_tune/__init__.py +1 -1
- flwr/cli/new/templates/app/code/flwr_tune/client_app.py.tpl +4 -4
- flwr/cli/new/templates/app/code/task.sklearn.py.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.baseline.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +4 -4
- flwr/cli/new/templates/app/pyproject.huggingface.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.jax.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.mlx.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.numpy.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl +1 -1
- flwr/cli/run/__init__.py +1 -1
- flwr/cli/run/run.py +1 -1
- flwr/cli/stop.py +1 -1
- flwr/cli/utils.py +11 -12
- flwr/client/__init__.py +1 -1
- flwr/client/app.py +52 -52
- flwr/client/client.py +1 -1
- flwr/client/client_app.py +139 -137
- flwr/client/clientapp/__init__.py +1 -1
- flwr/client/clientapp/app.py +1 -1
- flwr/client/clientapp/clientappio_servicer.py +1 -1
- flwr/client/clientapp/utils.py +1 -1
- flwr/client/dpfedavg_numpy_client.py +1 -1
- flwr/client/grpc_adapter_client/__init__.py +1 -1
- flwr/client/grpc_adapter_client/connection.py +1 -1
- flwr/client/grpc_client/__init__.py +1 -1
- flwr/client/grpc_client/connection.py +13 -13
- flwr/client/grpc_rere_client/__init__.py +1 -1
- flwr/client/grpc_rere_client/client_interceptor.py +1 -1
- flwr/client/grpc_rere_client/connection.py +1 -1
- flwr/client/grpc_rere_client/grpc_adapter.py +1 -1
- flwr/client/heartbeat.py +1 -1
- flwr/client/message_handler/__init__.py +1 -1
- flwr/client/message_handler/message_handler.py +1 -1
- flwr/client/mod/__init__.py +1 -1
- flwr/client/mod/centraldp_mods.py +1 -1
- flwr/client/mod/comms_mods.py +3 -3
- flwr/client/mod/localdp_mod.py +6 -6
- flwr/client/mod/secure_aggregation/__init__.py +1 -1
- flwr/client/mod/secure_aggregation/secagg_mod.py +1 -1
- flwr/client/mod/secure_aggregation/secaggplus_mod.py +1 -1
- flwr/client/mod/utils.py +1 -1
- flwr/client/nodestate/__init__.py +1 -1
- flwr/client/nodestate/in_memory_nodestate.py +1 -1
- flwr/client/nodestate/nodestate.py +1 -1
- flwr/client/nodestate/nodestate_factory.py +1 -1
- flwr/client/numpy_client.py +1 -1
- flwr/client/rest_client/__init__.py +1 -1
- flwr/client/rest_client/connection.py +1 -1
- flwr/client/run_info_store.py +1 -1
- flwr/client/supernode/__init__.py +1 -1
- flwr/client/supernode/app.py +1 -1
- flwr/client/typing.py +1 -1
- flwr/common/__init__.py +1 -1
- flwr/common/address.py +1 -1
- flwr/common/args.py +1 -1
- flwr/common/auth_plugin/__init__.py +1 -1
- flwr/common/auth_plugin/auth_plugin.py +1 -1
- flwr/common/config.py +1 -1
- flwr/common/constant.py +1 -1
- flwr/common/context.py +1 -1
- flwr/common/date.py +1 -1
- flwr/common/differential_privacy.py +1 -1
- flwr/common/differential_privacy_constants.py +1 -1
- flwr/common/dp.py +1 -1
- flwr/common/exit/exit.py +6 -6
- flwr/common/exit_handlers.py +1 -1
- flwr/common/grpc.py +1 -1
- flwr/common/logger.py +1 -1
- flwr/common/message.py +28 -11
- flwr/common/object_ref.py +1 -1
- flwr/common/parameter.py +1 -1
- flwr/common/pyproject.py +1 -1
- flwr/common/record/__init__.py +1 -1
- flwr/common/record/arrayrecord.py +31 -31
- flwr/common/record/configrecord.py +13 -13
- flwr/common/record/conversion_utils.py +1 -1
- flwr/common/record/metricrecord.py +16 -16
- flwr/common/record/recorddict.py +138 -89
- flwr/common/record/typeddict.py +1 -1
- flwr/common/retry_invoker.py +10 -10
- flwr/common/secure_aggregation/__init__.py +1 -1
- flwr/common/secure_aggregation/crypto/__init__.py +1 -1
- flwr/common/secure_aggregation/crypto/shamir.py +52 -30
- flwr/common/secure_aggregation/crypto/symmetric_encryption.py +1 -1
- flwr/common/secure_aggregation/ndarrays_arithmetic.py +1 -1
- flwr/common/secure_aggregation/quantization.py +1 -1
- flwr/common/secure_aggregation/secaggplus_constants.py +1 -1
- flwr/common/secure_aggregation/secaggplus_utils.py +1 -1
- flwr/common/serde.py +1 -1
- flwr/common/telemetry.py +2 -2
- flwr/common/typing.py +1 -1
- flwr/common/version.py +1 -1
- flwr/proto/__init__.py +1 -1
- flwr/server/__init__.py +1 -1
- flwr/server/app.py +11 -11
- flwr/server/client_manager.py +1 -1
- flwr/server/client_proxy.py +1 -1
- flwr/server/compat/__init__.py +1 -1
- flwr/server/compat/app.py +1 -1
- flwr/server/compat/app_utils.py +1 -1
- flwr/server/compat/legacy_context.py +1 -1
- flwr/server/criterion.py +1 -1
- flwr/server/grid/grid.py +3 -3
- flwr/server/history.py +1 -1
- flwr/server/run_serverapp.py +1 -1
- flwr/server/server.py +1 -1
- flwr/server/server_app.py +65 -58
- flwr/server/server_config.py +1 -1
- flwr/server/serverapp/__init__.py +1 -1
- flwr/server/serverapp/app.py +1 -1
- flwr/server/serverapp_components.py +1 -1
- flwr/server/strategy/__init__.py +1 -1
- flwr/server/strategy/aggregate.py +1 -1
- flwr/server/strategy/bulyan.py +2 -2
- flwr/server/strategy/dp_adaptive_clipping.py +17 -17
- flwr/server/strategy/dp_fixed_clipping.py +17 -17
- flwr/server/strategy/dpfedavg_adaptive.py +1 -1
- flwr/server/strategy/dpfedavg_fixed.py +1 -1
- flwr/server/strategy/fault_tolerant_fedavg.py +1 -1
- flwr/server/strategy/fedadagrad.py +1 -1
- flwr/server/strategy/fedadam.py +1 -1
- flwr/server/strategy/fedavg.py +1 -1
- flwr/server/strategy/fedavg_android.py +1 -1
- flwr/server/strategy/fedavgm.py +1 -1
- flwr/server/strategy/fedmedian.py +1 -1
- flwr/server/strategy/fedopt.py +1 -1
- flwr/server/strategy/fedprox.py +1 -1
- flwr/server/strategy/fedtrimmedavg.py +1 -1
- flwr/server/strategy/fedxgb_bagging.py +1 -1
- flwr/server/strategy/fedxgb_cyclic.py +1 -1
- flwr/server/strategy/fedxgb_nn_avg.py +3 -2
- flwr/server/strategy/fedyogi.py +1 -1
- flwr/server/strategy/krum.py +1 -1
- flwr/server/strategy/qfedavg.py +1 -1
- flwr/server/strategy/strategy.py +1 -1
- flwr/server/superlink/__init__.py +1 -1
- flwr/server/superlink/ffs/__init__.py +1 -1
- flwr/server/superlink/ffs/disk_ffs.py +1 -1
- flwr/server/superlink/ffs/ffs.py +1 -1
- flwr/server/superlink/ffs/ffs_factory.py +1 -1
- flwr/server/superlink/fleet/__init__.py +1 -1
- flwr/server/superlink/fleet/grpc_adapter/__init__.py +1 -1
- flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/__init__.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/flower_service_servicer.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/grpc_bridge.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/grpc_client_proxy.py +1 -1
- flwr/server/superlink/fleet/grpc_bidi/grpc_server.py +13 -13
- flwr/server/superlink/fleet/grpc_rere/__init__.py +1 -1
- flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +1 -1
- flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +1 -1
- flwr/server/superlink/fleet/message_handler/__init__.py +1 -1
- flwr/server/superlink/fleet/message_handler/message_handler.py +1 -1
- flwr/server/superlink/fleet/rest_rere/__init__.py +1 -1
- flwr/server/superlink/fleet/rest_rere/rest_api.py +1 -1
- flwr/server/superlink/fleet/vce/__init__.py +1 -1
- flwr/server/superlink/fleet/vce/backend/__init__.py +1 -1
- flwr/server/superlink/fleet/vce/backend/backend.py +1 -1
- flwr/server/superlink/fleet/vce/backend/raybackend.py +1 -1
- flwr/server/superlink/fleet/vce/vce_api.py +1 -1
- flwr/server/superlink/linkstate/__init__.py +1 -1
- flwr/server/superlink/linkstate/in_memory_linkstate.py +1 -1
- flwr/server/superlink/linkstate/linkstate.py +1 -1
- flwr/server/superlink/linkstate/linkstate_factory.py +1 -1
- flwr/server/superlink/linkstate/sqlite_linkstate.py +1 -1
- flwr/server/superlink/linkstate/utils.py +1 -1
- flwr/server/superlink/simulation/__init__.py +1 -1
- flwr/server/superlink/simulation/simulationio_grpc.py +1 -1
- flwr/server/superlink/simulation/simulationio_servicer.py +1 -1
- flwr/server/superlink/utils.py +1 -1
- flwr/server/typing.py +1 -1
- flwr/server/utils/__init__.py +1 -1
- flwr/server/utils/tensorboard.py +1 -1
- flwr/server/utils/validator.py +1 -1
- flwr/server/workflow/__init__.py +1 -1
- flwr/server/workflow/constant.py +1 -1
- flwr/server/workflow/default_workflows.py +1 -1
- flwr/server/workflow/secure_aggregation/__init__.py +1 -1
- flwr/server/workflow/secure_aggregation/secagg_workflow.py +1 -1
- flwr/server/workflow/secure_aggregation/secaggplus_workflow.py +1 -1
- flwr/simulation/__init__.py +1 -1
- flwr/simulation/app.py +1 -1
- flwr/simulation/legacy_app.py +1 -1
- flwr/simulation/ray_transport/__init__.py +1 -1
- flwr/simulation/ray_transport/ray_actor.py +1 -1
- flwr/simulation/ray_transport/ray_client_proxy.py +1 -1
- flwr/simulation/ray_transport/utils.py +1 -1
- flwr/simulation/run_simulation.py +2 -2
- flwr/simulation/simulationio_connection.py +1 -1
- flwr/superexec/__init__.py +1 -1
- flwr/superexec/app.py +1 -1
- flwr/superexec/deployment.py +1 -1
- flwr/superexec/exec_grpc.py +1 -1
- flwr/superexec/exec_servicer.py +1 -1
- flwr/superexec/exec_user_auth_interceptor.py +1 -1
- flwr/superexec/executor.py +1 -1
- flwr/superexec/simulation.py +1 -1
- {flwr-1.17.0.dist-info → flwr-1.18.0.dist-info}/METADATA +2 -2
- flwr-1.18.0.dist-info/RECORD +332 -0
- flwr-1.17.0.dist-info/LICENSE +0 -202
- flwr-1.17.0.dist-info/RECORD +0 -333
- {flwr-1.17.0.dist-info → flwr-1.18.0.dist-info}/WHEEL +0 -0
- {flwr-1.17.0.dist-info → flwr-1.18.0.dist-info}/entry_points.txt +0 -0
flwr/server/server.py
CHANGED
flwr/server/server_app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -52,6 +52,30 @@ GRID_USAGE_EXAMPLE = """
|
|
|
52
52
|
# Your existing ServerApp code ...
|
|
53
53
|
"""
|
|
54
54
|
|
|
55
|
+
BOTH_MAIN_FN_SERVER_FN_PROVIDED_ERROR_MSG = (
|
|
56
|
+
"Use either a custom main function or a `Strategy`, but not both."
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
Use the `ServerApp` with an existing `Strategy`:
|
|
60
|
+
|
|
61
|
+
server_config = ServerConfig(num_rounds=3)
|
|
62
|
+
strategy = FedAvg()
|
|
63
|
+
|
|
64
|
+
app = ServerApp(
|
|
65
|
+
server_config=server_config,
|
|
66
|
+
strategy=strategy,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
Use the `ServerApp` with a custom main function:
|
|
70
|
+
|
|
71
|
+
app = ServerApp()
|
|
72
|
+
|
|
73
|
+
@app.main()
|
|
74
|
+
def main(grid: Grid, context: Context) -> None:
|
|
75
|
+
print("ServerApp running")
|
|
76
|
+
"""
|
|
77
|
+
)
|
|
78
|
+
|
|
55
79
|
DRIVER_DEPRECATION_MSG = """
|
|
56
80
|
The `Driver` class is deprecated, it will be removed in a future release.
|
|
57
81
|
"""
|
|
@@ -70,25 +94,25 @@ class ServerApp: # pylint: disable=too-many-instance-attributes
|
|
|
70
94
|
|
|
71
95
|
Examples
|
|
72
96
|
--------
|
|
73
|
-
Use the ``ServerApp`` with an existing ``Strategy
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Use the ``ServerApp`` with a custom main function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
97
|
+
Use the ``ServerApp`` with an existing ``Strategy``::
|
|
98
|
+
|
|
99
|
+
def server_fn(context: Context):
|
|
100
|
+
server_config = ServerConfig(num_rounds=3)
|
|
101
|
+
strategy = FedAvg()
|
|
102
|
+
return ServerAppComponents(
|
|
103
|
+
strategy=strategy,
|
|
104
|
+
server_config=server_config,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
app = ServerApp(server_fn=server_fn)
|
|
108
|
+
|
|
109
|
+
Use the ``ServerApp`` with a custom main function::
|
|
110
|
+
|
|
111
|
+
app = ServerApp()
|
|
112
|
+
|
|
113
|
+
@app.main()
|
|
114
|
+
def main(grid: Grid, context: Context) -> None:
|
|
115
|
+
print("ServerApp running")
|
|
92
116
|
"""
|
|
93
117
|
|
|
94
118
|
# pylint: disable=too-many-arguments,too-many-positional-arguments
|
|
@@ -156,38 +180,19 @@ class ServerApp: # pylint: disable=too-many-instance-attributes
|
|
|
156
180
|
|
|
157
181
|
Examples
|
|
158
182
|
--------
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
183
|
+
::
|
|
184
|
+
|
|
185
|
+
app = ServerApp()
|
|
186
|
+
|
|
187
|
+
@app.main()
|
|
188
|
+
def main(grid: Grid, context: Context) -> None:
|
|
189
|
+
print("ServerApp running")
|
|
164
190
|
"""
|
|
165
191
|
|
|
166
192
|
def main_decorator(main_fn: ServerAppCallable) -> ServerAppCallable:
|
|
167
193
|
"""Register the main fn with the ServerApp object."""
|
|
168
194
|
if self._server or self._config or self._strategy or self._client_manager:
|
|
169
|
-
raise ValueError(
|
|
170
|
-
"""Use either a custom main function or a `Strategy`, but not both.
|
|
171
|
-
|
|
172
|
-
Use the `ServerApp` with an existing `Strategy`:
|
|
173
|
-
|
|
174
|
-
>>> server_config = ServerConfig(num_rounds=3)
|
|
175
|
-
>>> strategy = FedAvg()
|
|
176
|
-
>>>
|
|
177
|
-
>>> app = ServerApp(
|
|
178
|
-
>>> server_config=server_config,
|
|
179
|
-
>>> strategy=strategy,
|
|
180
|
-
>>> )
|
|
181
|
-
|
|
182
|
-
Use the `ServerApp` with a custom main function:
|
|
183
|
-
|
|
184
|
-
>>> app = ServerApp()
|
|
185
|
-
>>>
|
|
186
|
-
>>> @app.main()
|
|
187
|
-
>>> def main(grid: Grid, context: Context) -> None:
|
|
188
|
-
>>> print("ServerApp running")
|
|
189
|
-
""",
|
|
190
|
-
)
|
|
195
|
+
raise ValueError(BOTH_MAIN_FN_SERVER_FN_PROVIDED_ERROR_MSG)
|
|
191
196
|
|
|
192
197
|
sig = inspect.signature(main_fn)
|
|
193
198
|
param = list(sig.parameters.values())[0]
|
|
@@ -219,17 +224,19 @@ class ServerApp: # pylint: disable=too-many-instance-attributes
|
|
|
219
224
|
|
|
220
225
|
Examples
|
|
221
226
|
--------
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
::
|
|
228
|
+
|
|
229
|
+
app = ServerApp()
|
|
230
|
+
|
|
231
|
+
@app.lifespan()
|
|
232
|
+
def lifespan(context: Context) -> None:
|
|
233
|
+
# Perform initialization tasks before the app starts
|
|
234
|
+
print("Initializing ServerApp")
|
|
235
|
+
|
|
236
|
+
yield # ServerApp is running
|
|
237
|
+
|
|
238
|
+
# Perform cleanup tasks after the app stops
|
|
239
|
+
print("Cleaning up ServerApp")
|
|
233
240
|
"""
|
|
234
241
|
|
|
235
242
|
def lifespan_decorator(
|
flwr/server/server_config.py
CHANGED
flwr/server/serverapp/app.py
CHANGED
flwr/server/strategy/__init__.py
CHANGED
flwr/server/strategy/bulyan.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -37,7 +37,7 @@ from .aggregate import aggregate_bulyan, aggregate_krum
|
|
|
37
37
|
from .fedavg import FedAvg
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
#
|
|
40
|
+
# noqa: E501
|
|
41
41
|
# pylint: disable=line-too-long
|
|
42
42
|
class Bulyan(FedAvg):
|
|
43
43
|
"""Bulyan strategy.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -77,15 +77,15 @@ class DifferentialPrivacyServerSideAdaptiveClipping(Strategy):
|
|
|
77
77
|
|
|
78
78
|
Examples
|
|
79
79
|
--------
|
|
80
|
-
Create a strategy
|
|
80
|
+
Create a strategy::
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
strategy = fl.server.strategy.FedAvg( ... )
|
|
83
83
|
|
|
84
|
-
Wrap the strategy with the DifferentialPrivacyServerSideAdaptiveClipping wrapper
|
|
84
|
+
Wrap the strategy with the DifferentialPrivacyServerSideAdaptiveClipping wrapper::
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
dp_strategy = DifferentialPrivacyServerSideAdaptiveClipping(
|
|
87
|
+
strategy, cfg.noise_multiplier, cfg.num_sampled_clients, ...
|
|
88
|
+
)
|
|
89
89
|
"""
|
|
90
90
|
|
|
91
91
|
# pylint: disable=too-many-arguments,too-many-instance-attributes,too-many-positional-arguments
|
|
@@ -290,21 +290,21 @@ class DifferentialPrivacyClientSideAdaptiveClipping(Strategy):
|
|
|
290
290
|
|
|
291
291
|
Examples
|
|
292
292
|
--------
|
|
293
|
-
Create a strategy
|
|
293
|
+
Create a strategy::
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
strategy = fl.server.strategy.FedAvg(...)
|
|
296
296
|
|
|
297
|
-
Wrap the strategy with the `DifferentialPrivacyClientSideAdaptiveClipping` wrapper
|
|
297
|
+
Wrap the strategy with the `DifferentialPrivacyClientSideAdaptiveClipping` wrapper::
|
|
298
298
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
dp_strategy = DifferentialPrivacyClientSideAdaptiveClipping(
|
|
300
|
+
strategy, cfg.noise_multiplier, cfg.num_sampled_clients
|
|
301
|
+
)
|
|
302
302
|
|
|
303
|
-
On the client, add the `adaptiveclipping_mod` to the client-side mods
|
|
303
|
+
On the client, add the `adaptiveclipping_mod` to the client-side mods::
|
|
304
304
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
305
|
+
app = fl.client.ClientApp(
|
|
306
|
+
client_fn=client_fn, mods=[adaptiveclipping_mod]
|
|
307
|
+
)
|
|
308
308
|
"""
|
|
309
309
|
|
|
310
310
|
# pylint: disable=too-many-arguments,too-many-instance-attributes,too-many-positional-arguments
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -64,15 +64,15 @@ class DifferentialPrivacyServerSideFixedClipping(Strategy):
|
|
|
64
64
|
|
|
65
65
|
Examples
|
|
66
66
|
--------
|
|
67
|
-
Create a strategy
|
|
67
|
+
Create a strategy::
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
strategy = fl.server.strategy.FedAvg( ... )
|
|
70
70
|
|
|
71
|
-
Wrap the strategy with the DifferentialPrivacyServerSideFixedClipping wrapper
|
|
71
|
+
Wrap the strategy with the DifferentialPrivacyServerSideFixedClipping wrapper::
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
dp_strategy = DifferentialPrivacyServerSideFixedClipping(
|
|
74
|
+
strategy, cfg.noise_multiplier, cfg.clipping_norm, cfg.num_sampled_clients
|
|
75
|
+
)
|
|
76
76
|
"""
|
|
77
77
|
|
|
78
78
|
# pylint: disable=too-many-arguments,too-many-instance-attributes
|
|
@@ -228,21 +228,21 @@ class DifferentialPrivacyClientSideFixedClipping(Strategy):
|
|
|
228
228
|
|
|
229
229
|
Examples
|
|
230
230
|
--------
|
|
231
|
-
Create a strategy
|
|
231
|
+
Create a strategy::
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
strategy = fl.server.strategy.FedAvg(...)
|
|
234
234
|
|
|
235
|
-
Wrap the strategy with the `DifferentialPrivacyClientSideFixedClipping` wrapper
|
|
235
|
+
Wrap the strategy with the `DifferentialPrivacyClientSideFixedClipping` wrapper::
|
|
236
236
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
dp_strategy = DifferentialPrivacyClientSideFixedClipping(
|
|
238
|
+
strategy, cfg.noise_multiplier, cfg.clipping_norm, cfg.num_sampled_clients
|
|
239
|
+
)
|
|
240
240
|
|
|
241
|
-
On the client, add the `fixedclipping_mod` to the client-side mods
|
|
241
|
+
On the client, add the `fixedclipping_mod` to the client-side mods::
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
app = fl.client.ClientApp(
|
|
244
|
+
client_fn=client_fn, mods=[fixedclipping_mod]
|
|
245
|
+
)
|
|
246
246
|
"""
|
|
247
247
|
|
|
248
248
|
# pylint: disable=too-many-arguments,too-many-instance-attributes
|
flwr/server/strategy/fedadam.py
CHANGED
flwr/server/strategy/fedavg.py
CHANGED
flwr/server/strategy/fedavgm.py
CHANGED
flwr/server/strategy/fedopt.py
CHANGED
flwr/server/strategy/fedprox.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -44,7 +44,8 @@ class FedXgbNnAvg(FedAvg):
|
|
|
44
44
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
45
45
|
"""Federated XGBoost [Ma et al., 2023] strategy.
|
|
46
46
|
|
|
47
|
-
Implementation based on
|
|
47
|
+
Implementation based on
|
|
48
|
+
https://arxiv.org/abs/2304.07537.
|
|
48
49
|
"""
|
|
49
50
|
super().__init__(*args, **kwargs)
|
|
50
51
|
warn_deprecated_feature("`FedXgbNnAvg` strategy")
|
flwr/server/strategy/fedyogi.py
CHANGED
flwr/server/strategy/krum.py
CHANGED
flwr/server/strategy/qfedavg.py
CHANGED
flwr/server/strategy/strategy.py
CHANGED
flwr/server/superlink/ffs/ffs.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright
|
|
1
|
+
# Copyright 2025 Flower Labs GmbH. All Rights Reserved.
|
|
2
2
|
#
|
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
# you may not use this file except in compliance with the License.
|
|
@@ -96,18 +96,18 @@ def start_grpc_server( # pylint: disable=too-many-arguments,R0917
|
|
|
96
96
|
|
|
97
97
|
Examples
|
|
98
98
|
--------
|
|
99
|
-
Starting a
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
99
|
+
Starting a TLS-enabled server::
|
|
100
|
+
|
|
101
|
+
from pathlib import Path
|
|
102
|
+
start_grpc_server(
|
|
103
|
+
client_manager=ClientManager(),
|
|
104
|
+
server_address="localhost:8080",
|
|
105
|
+
certificates=(
|
|
106
|
+
Path("/crts/root.pem").read_bytes(),
|
|
107
|
+
Path("/crts/localhost.crt").read_bytes(),
|
|
108
|
+
Path("/crts/localhost.key").read_bytes(),
|
|
109
|
+
),
|
|
110
|
+
)
|
|
111
111
|
"""
|
|
112
112
|
servicer = FlowerServiceServicer(client_manager)
|
|
113
113
|
add_servicer_to_server_fn = add_FlowerServiceServicer_to_server
|