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/__init__.py
CHANGED
flwr/cli/__init__.py
CHANGED
flwr/cli/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.
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
# ==============================================================================
|
|
15
15
|
"""Flower command line interface."""
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
import typer
|
|
19
18
|
from typer.main import get_command
|
|
20
19
|
|
|
20
|
+
from flwr.common.version import package_version
|
|
21
|
+
|
|
21
22
|
from .build import build
|
|
22
23
|
from .install import install
|
|
23
24
|
from .log import log
|
|
@@ -34,6 +35,7 @@ app = typer.Typer(
|
|
|
34
35
|
bold=True,
|
|
35
36
|
),
|
|
36
37
|
no_args_is_help=True,
|
|
38
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
37
39
|
)
|
|
38
40
|
|
|
39
41
|
app.command()(new)
|
|
@@ -47,5 +49,22 @@ app.command()(login)
|
|
|
47
49
|
|
|
48
50
|
typer_click_object = get_command(app)
|
|
49
51
|
|
|
52
|
+
|
|
53
|
+
@app.callback(invoke_without_command=True)
|
|
54
|
+
def version_callback(
|
|
55
|
+
ver: bool = typer.Option(
|
|
56
|
+
None,
|
|
57
|
+
"-V",
|
|
58
|
+
"--version",
|
|
59
|
+
is_eager=True,
|
|
60
|
+
help="Show the version and exit.",
|
|
61
|
+
),
|
|
62
|
+
) -> None:
|
|
63
|
+
"""Print version."""
|
|
64
|
+
if ver:
|
|
65
|
+
typer.secho(f"Flower version: {package_version}", fg="blue")
|
|
66
|
+
raise typer.Exit()
|
|
67
|
+
|
|
68
|
+
|
|
50
69
|
if __name__ == "__main__":
|
|
51
70
|
app()
|
flwr/cli/build.py
CHANGED
flwr/cli/config_utils.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.
|
|
@@ -176,11 +176,32 @@ def validate_federation_in_project_config(
|
|
|
176
176
|
def validate_certificate_in_federation_config(
|
|
177
177
|
app: Path, federation_config: dict[str, Any]
|
|
178
178
|
) -> tuple[bool, Optional[bytes]]:
|
|
179
|
-
"""Validate the certificates in the Flower project configuration.
|
|
180
|
-
|
|
179
|
+
"""Validate the certificates in the Flower project configuration.
|
|
180
|
+
|
|
181
|
+
Accepted configurations:
|
|
182
|
+
1. TLS enabled and gRPC will load(*) the trusted certificate bundle:
|
|
183
|
+
- Only `address` is provided. `root-certificates` and `insecure` not set.
|
|
184
|
+
- `address` is provided and `insecure` set to `false`. `root-certificates` not
|
|
185
|
+
set.
|
|
186
|
+
(*)gRPC uses a multi-step fallback mechanism to load the trusted certificate
|
|
187
|
+
bundle in the following sequence:
|
|
188
|
+
a. A configured file path (if set via configuration or environment),
|
|
189
|
+
b. An override callback (if registered via
|
|
190
|
+
`grpc_set_ssl_roots_override_callback`),
|
|
191
|
+
c. The OS trust store (if available),
|
|
192
|
+
d. A bundled default certificate file.
|
|
193
|
+
2. TLS enabled with self-signed certificates:
|
|
194
|
+
- `address` and `root-certificates` are provided. `insecure` not set.
|
|
195
|
+
- `address` and `root-certificates` are provided. `insecure` set to `false`.
|
|
196
|
+
3. TLS disabled. This is not recommended and should only be used for prototyping:
|
|
197
|
+
- `address` is provided and `insecure = true`. If `root-certificates` is
|
|
198
|
+
set, exit with an error.
|
|
199
|
+
"""
|
|
200
|
+
insecure = get_insecure_flag(federation_config)
|
|
201
|
+
|
|
202
|
+
# Process root certificates
|
|
181
203
|
if root_certificates := federation_config.get("root-certificates"):
|
|
182
|
-
|
|
183
|
-
if insecure := bool(insecure_str):
|
|
204
|
+
if insecure:
|
|
184
205
|
typer.secho(
|
|
185
206
|
"❌ `root-certificates` were provided but the `insecure` parameter "
|
|
186
207
|
"is set to `True`.",
|
|
@@ -188,22 +209,19 @@ def validate_certificate_in_federation_config(
|
|
|
188
209
|
bold=True,
|
|
189
210
|
)
|
|
190
211
|
raise typer.Exit(code=1)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
fg=typer.colors.RED,
|
|
197
|
-
bold=True,
|
|
198
|
-
)
|
|
199
|
-
raise typer.Exit(code=1)
|
|
200
|
-
if not (insecure := bool(insecure_str)):
|
|
212
|
+
|
|
213
|
+
# TLS is enabled with self-signed certificates: attempt to read the file
|
|
214
|
+
try:
|
|
215
|
+
root_certificates_bytes = (app / root_certificates).read_bytes()
|
|
216
|
+
except Exception as e:
|
|
201
217
|
typer.secho(
|
|
202
|
-
"❌
|
|
218
|
+
f"❌ Failed to read certificate file `{root_certificates}`: {e}",
|
|
203
219
|
fg=typer.colors.RED,
|
|
204
220
|
bold=True,
|
|
205
221
|
)
|
|
206
|
-
raise typer.Exit(code=1)
|
|
222
|
+
raise typer.Exit(code=1) from e
|
|
223
|
+
else:
|
|
224
|
+
root_certificates_bytes = None
|
|
207
225
|
|
|
208
226
|
return insecure, root_certificates_bytes
|
|
209
227
|
|
|
@@ -218,3 +236,21 @@ def exit_if_no_address(federation_config: dict[str, Any], cmd: str) -> None:
|
|
|
218
236
|
bold=True,
|
|
219
237
|
)
|
|
220
238
|
raise typer.Exit(code=1)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def get_insecure_flag(federation_config: dict[str, Any]) -> bool:
|
|
242
|
+
"""Extract and validate the `insecure` flag from the federation configuration."""
|
|
243
|
+
insecure_value = federation_config.get("insecure")
|
|
244
|
+
|
|
245
|
+
if insecure_value is None:
|
|
246
|
+
# Not provided, default to False (TLS enabled)
|
|
247
|
+
return False
|
|
248
|
+
if isinstance(insecure_value, bool):
|
|
249
|
+
return insecure_value
|
|
250
|
+
typer.secho(
|
|
251
|
+
"❌ Invalid type for `insecure`: expected a boolean if provided. "
|
|
252
|
+
"(`insecure = true` or `insecure = false`)",
|
|
253
|
+
fg=typer.colors.RED,
|
|
254
|
+
bold=True,
|
|
255
|
+
)
|
|
256
|
+
raise typer.Exit(code=1)
|
flwr/cli/example.py
CHANGED
flwr/cli/install.py
CHANGED
flwr/cli/log.py
CHANGED
flwr/cli/login/__init__.py
CHANGED
flwr/cli/login/login.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.
|
|
@@ -22,6 +22,7 @@ import typer
|
|
|
22
22
|
|
|
23
23
|
from flwr.cli.config_utils import (
|
|
24
24
|
exit_if_no_address,
|
|
25
|
+
get_insecure_flag,
|
|
25
26
|
load_and_validate,
|
|
26
27
|
process_loaded_project_config,
|
|
27
28
|
validate_federation_in_project_config,
|
|
@@ -80,6 +81,16 @@ def login( # pylint: disable=R0914
|
|
|
80
81
|
bold=True,
|
|
81
82
|
)
|
|
82
83
|
raise typer.Exit(code=1)
|
|
84
|
+
# Check if insecure flag is set to `True`
|
|
85
|
+
insecure = get_insecure_flag(federation_config)
|
|
86
|
+
if insecure:
|
|
87
|
+
typer.secho(
|
|
88
|
+
"❌ `flwr login` requires TLS to be enabled. `insecure` must NOT be set to "
|
|
89
|
+
"`true` in the federation configuration.",
|
|
90
|
+
fg=typer.colors.RED,
|
|
91
|
+
bold=True,
|
|
92
|
+
)
|
|
93
|
+
raise typer.Exit(code=1)
|
|
83
94
|
|
|
84
95
|
channel = init_channel(app, federation_config, None)
|
|
85
96
|
stub = ExecStub(channel)
|
flwr/cli/ls.py
CHANGED
flwr/cli/new/__init__.py
CHANGED
flwr/cli/new/new.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.
|
|
@@ -201,15 +201,15 @@ def new(
|
|
|
201
201
|
if llm_challenge_str == "generalnlp":
|
|
202
202
|
challenge_name = "General NLP"
|
|
203
203
|
num_clients = "20"
|
|
204
|
-
dataset_name = "
|
|
204
|
+
dataset_name = "flwrlabs/alpaca-gpt4"
|
|
205
205
|
elif llm_challenge_str == "finance":
|
|
206
206
|
challenge_name = "Finance"
|
|
207
207
|
num_clients = "50"
|
|
208
|
-
dataset_name = "
|
|
208
|
+
dataset_name = "flwrlabs/fingpt-sentiment-train"
|
|
209
209
|
elif llm_challenge_str == "medical":
|
|
210
210
|
challenge_name = "Medical"
|
|
211
211
|
num_clients = "20"
|
|
212
|
-
dataset_name = "
|
|
212
|
+
dataset_name = "flwrlabs/medical-meadow-medical-flashcards"
|
|
213
213
|
else:
|
|
214
214
|
challenge_name = "Code"
|
|
215
215
|
num_clients = "10"
|
|
@@ -49,7 +49,7 @@ class FlowerClient(NumPyClient):
|
|
|
49
49
|
): # pylint: disable=too-many-arguments
|
|
50
50
|
self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
51
51
|
self.train_cfg = train_cfg
|
|
52
|
-
self.
|
|
52
|
+
self.training_arguments = TrainingArguments(**train_cfg.training_arguments)
|
|
53
53
|
self.tokenizer = tokenizer
|
|
54
54
|
self.formatting_prompts_func = formatting_prompts_func
|
|
55
55
|
self.data_collator = data_collator
|
|
@@ -72,14 +72,14 @@ class FlowerClient(NumPyClient):
|
|
|
72
72
|
self.train_cfg.learning_rate_min,
|
|
73
73
|
)
|
|
74
74
|
|
|
75
|
-
self.
|
|
76
|
-
self.
|
|
75
|
+
self.training_arguments.learning_rate = new_lr
|
|
76
|
+
self.training_arguments.output_dir = config["save_path"]
|
|
77
77
|
|
|
78
78
|
# Construct trainer
|
|
79
79
|
trainer = SFTTrainer(
|
|
80
80
|
model=self.model,
|
|
81
81
|
tokenizer=self.tokenizer,
|
|
82
|
-
args=self.
|
|
82
|
+
args=self.training_arguments,
|
|
83
83
|
max_seq_length=self.train_cfg.seq_length,
|
|
84
84
|
train_dataset=self.trainset,
|
|
85
85
|
formatting_func=self.formatting_prompts_func,
|
|
@@ -8,14 +8,14 @@ version = "1.0.0"
|
|
|
8
8
|
description = ""
|
|
9
9
|
license = "Apache-2.0"
|
|
10
10
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
11
|
+
"flwr[simulation]>=1.18.0",
|
|
12
12
|
"flwr-datasets>=0.5.0",
|
|
13
|
-
"torch==2.
|
|
13
|
+
"torch==2.4.0",
|
|
14
14
|
"trl==0.8.1",
|
|
15
|
-
"bitsandbytes==0.45.
|
|
15
|
+
"bitsandbytes==0.45.4",
|
|
16
16
|
"scipy==1.13.0",
|
|
17
17
|
"peft==0.6.2",
|
|
18
|
-
"transformers==4.
|
|
18
|
+
"transformers==4.50.3",
|
|
19
19
|
"sentencepiece==0.2.0",
|
|
20
20
|
"omegaconf==2.3.0",
|
|
21
21
|
"hf_transfer==0.1.8",
|
flwr/cli/run/__init__.py
CHANGED
flwr/cli/run/run.py
CHANGED
flwr/cli/stop.py
CHANGED
flwr/cli/utils.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.
|
|
@@ -220,17 +220,6 @@ def try_obtain_cli_auth_plugin(
|
|
|
220
220
|
if not federation_config.get("enable-user-auth", False):
|
|
221
221
|
return None
|
|
222
222
|
|
|
223
|
-
# Check if TLS is enabled. If not, raise an error
|
|
224
|
-
if federation_config.get("root-certificates") is None:
|
|
225
|
-
typer.secho(
|
|
226
|
-
"❌ User authentication requires TLS to be enabled. "
|
|
227
|
-
"Please provide 'root-certificates' in the federation"
|
|
228
|
-
" configuration.",
|
|
229
|
-
fg=typer.colors.RED,
|
|
230
|
-
bold=True,
|
|
231
|
-
)
|
|
232
|
-
raise typer.Exit(code=1)
|
|
233
|
-
|
|
234
223
|
config_path = get_user_auth_config_path(root_dir, federation)
|
|
235
224
|
|
|
236
225
|
# Get the auth type from the config if not provided
|
|
@@ -273,6 +262,16 @@ def init_channel(
|
|
|
273
262
|
# Initialize the CLI-side user auth interceptor
|
|
274
263
|
interceptors: list[grpc.UnaryUnaryClientInterceptor] = []
|
|
275
264
|
if auth_plugin is not None:
|
|
265
|
+
# Check if TLS is enabled. If not, raise an error
|
|
266
|
+
if insecure:
|
|
267
|
+
typer.secho(
|
|
268
|
+
"❌ User authentication requires TLS to be enabled. "
|
|
269
|
+
"Remove `insecure = true` from the federation configuration.",
|
|
270
|
+
fg=typer.colors.RED,
|
|
271
|
+
bold=True,
|
|
272
|
+
)
|
|
273
|
+
raise typer.Exit(code=1)
|
|
274
|
+
|
|
276
275
|
auth_plugin.load_tokens()
|
|
277
276
|
interceptors.append(CliUserAuthInterceptor(auth_plugin))
|
|
278
277
|
|
flwr/client/__init__.py
CHANGED
flwr/client/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.
|
|
@@ -158,33 +158,33 @@ def start_client(
|
|
|
158
158
|
|
|
159
159
|
Examples
|
|
160
160
|
--------
|
|
161
|
-
Starting a gRPC client with an insecure server connection
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
Starting
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
Starting
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
161
|
+
Starting a gRPC client with an insecure server connection::
|
|
162
|
+
|
|
163
|
+
start_client(
|
|
164
|
+
server_address=localhost:8080,
|
|
165
|
+
client_fn=client_fn,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
Starting a TLS-enabled gRPC client using system certificates::
|
|
169
|
+
|
|
170
|
+
def client_fn(context: Context):
|
|
171
|
+
return FlowerClient().to_client()
|
|
172
|
+
|
|
173
|
+
start_client(
|
|
174
|
+
server_address=localhost:8080,
|
|
175
|
+
client_fn=client_fn,
|
|
176
|
+
insecure=False,
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
Starting a TLS-enabled gRPC client using provided certificates::
|
|
180
|
+
|
|
181
|
+
from pathlib import Path
|
|
182
|
+
|
|
183
|
+
start_client(
|
|
184
|
+
server_address=localhost:8080,
|
|
185
|
+
client_fn=client_fn,
|
|
186
|
+
root_certificates=Path("/crts/root.pem").read_bytes(),
|
|
187
|
+
)
|
|
188
188
|
"""
|
|
189
189
|
msg = (
|
|
190
190
|
"flwr.client.start_client() is deprecated."
|
|
@@ -684,30 +684,30 @@ def start_numpy_client(
|
|
|
684
684
|
|
|
685
685
|
Examples
|
|
686
686
|
--------
|
|
687
|
-
Starting a gRPC client with an insecure server connection
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
Starting
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
Starting
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
687
|
+
Starting a gRPC client with an insecure server connection::
|
|
688
|
+
|
|
689
|
+
start_numpy_client(
|
|
690
|
+
server_address=localhost:8080,
|
|
691
|
+
client=FlowerClient(),
|
|
692
|
+
)
|
|
693
|
+
|
|
694
|
+
Starting a TLS-enabled gRPC client using system certificates::
|
|
695
|
+
|
|
696
|
+
start_numpy_client(
|
|
697
|
+
server_address=localhost:8080,
|
|
698
|
+
client=FlowerClient(),
|
|
699
|
+
insecure=False,
|
|
700
|
+
)
|
|
701
|
+
|
|
702
|
+
Starting a TLS-enabled gRPC client using provided certificates::
|
|
703
|
+
|
|
704
|
+
from pathlib import Path
|
|
705
|
+
|
|
706
|
+
start_numpy_client(
|
|
707
|
+
server_address=localhost:8080,
|
|
708
|
+
client=FlowerClient(),
|
|
709
|
+
root_certificates=Path("/crts/root.pem").read_bytes(),
|
|
710
|
+
)
|
|
711
711
|
"""
|
|
712
712
|
mssg = (
|
|
713
713
|
"flwr.client.start_numpy_client() is deprecated. \n\tInstead, use "
|
flwr/client/client.py
CHANGED