flwr 1.15.2__py3-none-any.whl → 1.17.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/cli/build.py +2 -0
- flwr/cli/log.py +20 -21
- flwr/cli/new/templates/app/code/flwr_tune/client_app.py.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.baseline.toml.tpl +1 -1
- flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +1 -1
- 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/run.py +5 -9
- flwr/client/app.py +6 -4
- flwr/client/client_app.py +260 -86
- flwr/client/clientapp/app.py +6 -2
- flwr/client/grpc_client/connection.py +24 -21
- flwr/client/message_handler/message_handler.py +28 -28
- flwr/client/mod/__init__.py +2 -2
- flwr/client/mod/centraldp_mods.py +7 -7
- flwr/client/mod/comms_mods.py +16 -22
- flwr/client/mod/localdp_mod.py +4 -4
- flwr/client/mod/secure_aggregation/secaggplus_mod.py +31 -31
- flwr/client/rest_client/connection.py +4 -6
- flwr/client/run_info_store.py +2 -2
- flwr/client/supernode/__init__.py +0 -2
- flwr/client/supernode/app.py +1 -11
- flwr/common/__init__.py +12 -4
- flwr/common/address.py +35 -0
- flwr/common/args.py +8 -2
- flwr/common/auth_plugin/auth_plugin.py +2 -1
- flwr/common/config.py +4 -4
- flwr/common/constant.py +16 -0
- flwr/common/context.py +4 -4
- flwr/common/event_log_plugin/__init__.py +22 -0
- flwr/common/event_log_plugin/event_log_plugin.py +60 -0
- flwr/common/grpc.py +1 -1
- flwr/common/logger.py +2 -2
- flwr/common/message.py +338 -102
- flwr/common/object_ref.py +0 -10
- flwr/common/record/__init__.py +8 -4
- flwr/common/record/arrayrecord.py +626 -0
- flwr/common/record/{configsrecord.py → configrecord.py} +75 -29
- flwr/common/record/conversion_utils.py +9 -18
- flwr/common/record/{metricsrecord.py → metricrecord.py} +78 -32
- flwr/common/record/recorddict.py +288 -0
- flwr/common/recorddict_compat.py +410 -0
- flwr/common/secure_aggregation/quantization.py +5 -1
- flwr/common/secure_aggregation/secaggplus_constants.py +1 -1
- flwr/common/serde.py +67 -190
- flwr/common/telemetry.py +0 -10
- flwr/common/typing.py +44 -8
- flwr/proto/exec_pb2.py +3 -3
- flwr/proto/exec_pb2.pyi +3 -3
- flwr/proto/message_pb2.py +12 -12
- flwr/proto/message_pb2.pyi +9 -9
- flwr/proto/recorddict_pb2.py +70 -0
- flwr/proto/{recordset_pb2.pyi → recorddict_pb2.pyi} +35 -35
- flwr/proto/run_pb2.py +31 -31
- flwr/proto/run_pb2.pyi +3 -3
- flwr/server/__init__.py +3 -1
- flwr/server/app.py +74 -3
- flwr/server/compat/__init__.py +2 -2
- flwr/server/compat/app.py +15 -12
- flwr/server/compat/app_utils.py +26 -18
- flwr/server/compat/{driver_client_proxy.py → grid_client_proxy.py} +41 -41
- flwr/server/fleet_event_log_interceptor.py +94 -0
- flwr/server/{driver → grid}/__init__.py +8 -7
- flwr/server/{driver/driver.py → grid/grid.py} +48 -19
- flwr/server/{driver/grpc_driver.py → grid/grpc_grid.py} +88 -56
- flwr/server/{driver/inmemory_driver.py → grid/inmemory_grid.py} +41 -54
- flwr/server/run_serverapp.py +6 -17
- flwr/server/server_app.py +126 -33
- flwr/server/serverapp/app.py +10 -10
- flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +2 -2
- flwr/server/superlink/fleet/message_handler/message_handler.py +8 -12
- flwr/server/superlink/fleet/vce/backend/backend.py +3 -3
- flwr/server/superlink/fleet/vce/backend/raybackend.py +2 -2
- flwr/server/superlink/fleet/vce/vce_api.py +33 -38
- flwr/server/superlink/linkstate/in_memory_linkstate.py +171 -132
- flwr/server/superlink/linkstate/linkstate.py +51 -64
- flwr/server/superlink/linkstate/sqlite_linkstate.py +253 -285
- flwr/server/superlink/linkstate/utils.py +171 -133
- flwr/server/superlink/{driver → serverappio}/__init__.py +1 -1
- flwr/server/superlink/{driver → serverappio}/serverappio_grpc.py +1 -1
- flwr/server/superlink/{driver → serverappio}/serverappio_servicer.py +27 -29
- flwr/server/superlink/simulation/simulationio_servicer.py +2 -2
- flwr/server/typing.py +3 -3
- flwr/server/utils/__init__.py +2 -2
- flwr/server/utils/validator.py +53 -68
- flwr/server/workflow/default_workflows.py +52 -58
- flwr/server/workflow/secure_aggregation/secaggplus_workflow.py +48 -50
- flwr/simulation/app.py +2 -2
- flwr/simulation/ray_transport/ray_actor.py +4 -2
- flwr/simulation/ray_transport/ray_client_proxy.py +34 -32
- flwr/simulation/run_simulation.py +15 -15
- flwr/superexec/app.py +0 -14
- flwr/superexec/deployment.py +4 -4
- flwr/superexec/exec_event_log_interceptor.py +135 -0
- flwr/superexec/exec_grpc.py +10 -4
- flwr/superexec/exec_servicer.py +6 -6
- flwr/superexec/exec_user_auth_interceptor.py +22 -4
- flwr/superexec/executor.py +3 -3
- flwr/superexec/simulation.py +3 -3
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/METADATA +5 -5
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/RECORD +111 -112
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/entry_points.txt +0 -3
- flwr/client/message_handler/task_handler.py +0 -37
- flwr/common/record/parametersrecord.py +0 -204
- flwr/common/record/recordset.py +0 -202
- flwr/common/recordset_compat.py +0 -418
- flwr/proto/recordset_pb2.py +0 -70
- flwr/proto/task_pb2.py +0 -33
- flwr/proto/task_pb2.pyi +0 -100
- flwr/proto/task_pb2_grpc.py +0 -4
- flwr/proto/task_pb2_grpc.pyi +0 -4
- /flwr/proto/{recordset_pb2_grpc.py → recorddict_pb2_grpc.py} +0 -0
- /flwr/proto/{recordset_pb2_grpc.pyi → recorddict_pb2_grpc.pyi} +0 -0
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/LICENSE +0 -0
- {flwr-1.15.2.dist-info → flwr-1.17.0.dist-info}/WHEEL +0 -0
flwr/cli/build.py
CHANGED
flwr/cli/log.py
CHANGED
|
@@ -38,6 +38,10 @@ from flwr.proto.exec_pb2_grpc import ExecStub
|
|
|
38
38
|
from .utils import init_channel, try_obtain_cli_auth_plugin, unauthenticated_exc_handler
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
class AllLogsRetrieved(BaseException):
|
|
42
|
+
"""Raised when all logs are retrieved."""
|
|
43
|
+
|
|
44
|
+
|
|
41
45
|
def start_stream(
|
|
42
46
|
run_id: int, channel: grpc.Channel, refresh_period: int = CONN_REFRESH_PERIOD
|
|
43
47
|
) -> None:
|
|
@@ -56,10 +60,10 @@ def start_stream(
|
|
|
56
60
|
# pylint: disable=E1101
|
|
57
61
|
if e.code() == grpc.StatusCode.NOT_FOUND:
|
|
58
62
|
logger(ERROR, "Invalid run_id `%s`, exiting", run_id)
|
|
59
|
-
if e.code() == grpc.StatusCode.CANCELLED:
|
|
60
|
-
pass
|
|
61
63
|
else:
|
|
62
64
|
raise e
|
|
65
|
+
except AllLogsRetrieved:
|
|
66
|
+
pass
|
|
63
67
|
finally:
|
|
64
68
|
channel.close()
|
|
65
69
|
|
|
@@ -94,6 +98,7 @@ def stream_logs(
|
|
|
94
98
|
with unauthenticated_exc_handler():
|
|
95
99
|
for res in stub.StreamLogs(req, timeout=duration):
|
|
96
100
|
print(res.log_output, end="")
|
|
101
|
+
raise AllLogsRetrieved()
|
|
97
102
|
except grpc.RpcError as e:
|
|
98
103
|
# pylint: disable=E1101
|
|
99
104
|
if e.code() != grpc.StatusCode.DEADLINE_EXCEEDED:
|
|
@@ -108,27 +113,21 @@ def stream_logs(
|
|
|
108
113
|
def print_logs(run_id: int, channel: grpc.Channel, timeout: int) -> None:
|
|
109
114
|
"""Print logs from the beginning of a run."""
|
|
110
115
|
stub = ExecStub(channel)
|
|
111
|
-
req = StreamLogsRequest(run_id=run_id)
|
|
116
|
+
req = StreamLogsRequest(run_id=run_id, after_timestamp=0.0)
|
|
112
117
|
|
|
113
118
|
try:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
break
|
|
127
|
-
if e.code() == grpc.StatusCode.CANCELLED:
|
|
128
|
-
break
|
|
129
|
-
raise e
|
|
130
|
-
except KeyboardInterrupt:
|
|
131
|
-
logger(DEBUG, "Stream interrupted by user")
|
|
119
|
+
with unauthenticated_exc_handler():
|
|
120
|
+
# Enforce timeout for graceful exit
|
|
121
|
+
for res in stub.StreamLogs(req, timeout=timeout):
|
|
122
|
+
print(res.log_output)
|
|
123
|
+
break
|
|
124
|
+
except grpc.RpcError as e:
|
|
125
|
+
if e.code() == grpc.StatusCode.NOT_FOUND: # pylint: disable=E1101
|
|
126
|
+
logger(ERROR, "Invalid run_id `%s`, exiting", run_id)
|
|
127
|
+
elif e.code() == grpc.StatusCode.DEADLINE_EXCEEDED: # pylint: disable=E1101
|
|
128
|
+
pass
|
|
129
|
+
else:
|
|
130
|
+
raise e
|
|
132
131
|
finally:
|
|
133
132
|
channel.close()
|
|
134
133
|
logger(DEBUG, "Channel closed")
|
|
@@ -35,7 +35,7 @@ warnings.filterwarnings("ignore", category=UserWarning)
|
|
|
35
35
|
# pylint: disable=too-many-arguments
|
|
36
36
|
# pylint: disable=too-many-instance-attributes
|
|
37
37
|
class FlowerClient(NumPyClient):
|
|
38
|
-
"""
|
|
38
|
+
"""Flower client for LLM fine-tuning."""
|
|
39
39
|
|
|
40
40
|
def __init__(
|
|
41
41
|
self,
|
flwr/cli/run/run.py
CHANGED
|
@@ -35,15 +35,11 @@ from flwr.cli.constant import FEDERATION_CONFIG_HELP_MESSAGE
|
|
|
35
35
|
from flwr.common.config import (
|
|
36
36
|
flatten_dict,
|
|
37
37
|
parse_config_args,
|
|
38
|
-
|
|
38
|
+
user_config_to_configrecord,
|
|
39
39
|
)
|
|
40
40
|
from flwr.common.constant import CliOutputFormat
|
|
41
41
|
from flwr.common.logger import print_json_error, redirect_output, restore_output
|
|
42
|
-
from flwr.common.serde import
|
|
43
|
-
configs_record_to_proto,
|
|
44
|
-
fab_to_proto,
|
|
45
|
-
user_config_to_proto,
|
|
46
|
-
)
|
|
42
|
+
from flwr.common.serde import config_record_to_proto, fab_to_proto, user_config_to_proto
|
|
47
43
|
from flwr.common.typing import Fab
|
|
48
44
|
from flwr.proto.exec_pb2 import StartRunRequest # pylint: disable=E0611
|
|
49
45
|
from flwr.proto.exec_pb2_grpc import ExecStub
|
|
@@ -171,14 +167,14 @@ def _run_with_exec_api(
|
|
|
171
167
|
|
|
172
168
|
fab = Fab(fab_hash, content)
|
|
173
169
|
|
|
174
|
-
# Construct a `
|
|
170
|
+
# Construct a `ConfigRecord` out of a flattened `UserConfig`
|
|
175
171
|
fed_conf = flatten_dict(federation_config.get("options", {}))
|
|
176
|
-
c_record =
|
|
172
|
+
c_record = user_config_to_configrecord(fed_conf)
|
|
177
173
|
|
|
178
174
|
req = StartRunRequest(
|
|
179
175
|
fab=fab_to_proto(fab),
|
|
180
176
|
override_config=user_config_to_proto(parse_config_args(config_overrides)),
|
|
181
|
-
federation_options=
|
|
177
|
+
federation_options=config_record_to_proto(c_record),
|
|
182
178
|
)
|
|
183
179
|
with unauthenticated_exc_handler():
|
|
184
180
|
res = stub.StartRun(req)
|
flwr/client/app.py
CHANGED
|
@@ -495,8 +495,9 @@ def start_client_internal(
|
|
|
495
495
|
context = run_info_store.retrieve_context(run_id=run_id)
|
|
496
496
|
# Create an error reply message that will never be used to prevent
|
|
497
497
|
# the used-before-assignment linting error
|
|
498
|
-
reply_message =
|
|
499
|
-
|
|
498
|
+
reply_message = Message(
|
|
499
|
+
Error(code=ErrorCode.UNKNOWN, reason="Unknown"),
|
|
500
|
+
reply_to=message,
|
|
500
501
|
)
|
|
501
502
|
|
|
502
503
|
# Handle app loading and task message
|
|
@@ -593,8 +594,9 @@ def start_client_internal(
|
|
|
593
594
|
log(ERROR, "%s raised an exception", exc_entity, exc_info=ex)
|
|
594
595
|
|
|
595
596
|
# Create error message
|
|
596
|
-
reply_message =
|
|
597
|
-
|
|
597
|
+
reply_message = Message(
|
|
598
|
+
Error(code=e_code, reason=reason),
|
|
599
|
+
reply_to=message,
|
|
598
600
|
)
|
|
599
601
|
else:
|
|
600
602
|
# No exception, update node state
|