flwr 1.18.0__py3-none-any.whl → 1.20.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/app/__init__.py +15 -0
- flwr/app/error.py +68 -0
- flwr/app/metadata.py +223 -0
- flwr/cli/build.py +94 -59
- flwr/cli/log.py +3 -3
- flwr/cli/login/login.py +3 -7
- flwr/cli/ls.py +15 -36
- flwr/cli/new/new.py +12 -4
- flwr/cli/new/templates/app/README.flowertune.md.tpl +2 -0
- flwr/cli/new/templates/app/README.md.tpl +5 -0
- flwr/cli/new/templates/app/code/client.baseline.py.tpl +1 -1
- flwr/cli/new/templates/app/code/model.baseline.py.tpl +1 -1
- flwr/cli/new/templates/app/code/server.baseline.py.tpl +2 -3
- flwr/cli/new/templates/app/pyproject.baseline.toml.tpl +25 -17
- flwr/cli/new/templates/app/pyproject.flowertune.toml.tpl +13 -1
- flwr/cli/new/templates/app/pyproject.huggingface.toml.tpl +21 -2
- flwr/cli/new/templates/app/pyproject.jax.toml.tpl +18 -1
- flwr/cli/new/templates/app/pyproject.mlx.toml.tpl +19 -2
- flwr/cli/new/templates/app/pyproject.numpy.toml.tpl +18 -1
- flwr/cli/new/templates/app/pyproject.pytorch.toml.tpl +20 -3
- flwr/cli/new/templates/app/pyproject.sklearn.toml.tpl +18 -1
- flwr/cli/new/templates/app/pyproject.tensorflow.toml.tpl +18 -1
- flwr/cli/run/run.py +48 -49
- flwr/cli/stop.py +2 -2
- flwr/cli/utils.py +38 -5
- flwr/client/__init__.py +2 -2
- flwr/client/client_app.py +1 -1
- flwr/client/clientapp/__init__.py +0 -7
- flwr/client/grpc_adapter_client/connection.py +15 -8
- flwr/client/grpc_rere_client/connection.py +142 -97
- flwr/client/grpc_rere_client/grpc_adapter.py +34 -6
- flwr/client/message_handler/message_handler.py +1 -1
- flwr/client/mod/comms_mods.py +36 -17
- flwr/client/rest_client/connection.py +176 -103
- flwr/clientapp/__init__.py +15 -0
- flwr/common/__init__.py +2 -2
- flwr/common/auth_plugin/__init__.py +2 -0
- flwr/common/auth_plugin/auth_plugin.py +29 -3
- flwr/common/constant.py +39 -8
- flwr/common/event_log_plugin/event_log_plugin.py +3 -3
- flwr/common/exit/exit_code.py +16 -1
- flwr/common/exit_handlers.py +30 -0
- flwr/common/grpc.py +12 -1
- flwr/common/heartbeat.py +165 -0
- flwr/common/inflatable.py +290 -0
- flwr/common/inflatable_protobuf_utils.py +141 -0
- flwr/common/inflatable_utils.py +508 -0
- flwr/common/message.py +110 -242
- flwr/common/record/__init__.py +2 -1
- flwr/common/record/array.py +402 -0
- flwr/common/record/arraychunk.py +59 -0
- flwr/common/record/arrayrecord.py +103 -225
- flwr/common/record/configrecord.py +59 -4
- flwr/common/record/conversion_utils.py +1 -1
- flwr/common/record/metricrecord.py +55 -4
- flwr/common/record/recorddict.py +69 -1
- flwr/common/recorddict_compat.py +2 -2
- flwr/common/retry_invoker.py +5 -1
- flwr/common/serde.py +59 -211
- flwr/common/serde_utils.py +175 -0
- flwr/common/typing.py +5 -3
- flwr/compat/__init__.py +15 -0
- flwr/compat/client/__init__.py +15 -0
- flwr/{client → compat/client}/app.py +28 -185
- flwr/compat/common/__init__.py +15 -0
- flwr/compat/server/__init__.py +15 -0
- flwr/compat/server/app.py +174 -0
- flwr/compat/simulation/__init__.py +15 -0
- flwr/proto/appio_pb2.py +43 -0
- flwr/proto/appio_pb2.pyi +151 -0
- flwr/proto/appio_pb2_grpc.py +4 -0
- flwr/proto/appio_pb2_grpc.pyi +4 -0
- flwr/proto/clientappio_pb2.py +12 -19
- flwr/proto/clientappio_pb2.pyi +23 -101
- flwr/proto/clientappio_pb2_grpc.py +269 -28
- flwr/proto/clientappio_pb2_grpc.pyi +114 -20
- flwr/proto/fleet_pb2.py +24 -27
- flwr/proto/fleet_pb2.pyi +19 -35
- flwr/proto/fleet_pb2_grpc.py +117 -13
- flwr/proto/fleet_pb2_grpc.pyi +47 -6
- flwr/proto/heartbeat_pb2.py +33 -0
- flwr/proto/heartbeat_pb2.pyi +66 -0
- flwr/proto/heartbeat_pb2_grpc.py +4 -0
- flwr/proto/heartbeat_pb2_grpc.pyi +4 -0
- flwr/proto/message_pb2.py +28 -11
- flwr/proto/message_pb2.pyi +125 -0
- flwr/proto/recorddict_pb2.py +16 -28
- flwr/proto/recorddict_pb2.pyi +46 -64
- flwr/proto/run_pb2.py +24 -32
- flwr/proto/run_pb2.pyi +4 -52
- flwr/proto/serverappio_pb2.py +9 -23
- flwr/proto/serverappio_pb2.pyi +0 -110
- flwr/proto/serverappio_pb2_grpc.py +177 -72
- flwr/proto/serverappio_pb2_grpc.pyi +75 -33
- flwr/proto/simulationio_pb2.py +12 -11
- flwr/proto/simulationio_pb2_grpc.py +35 -0
- flwr/proto/simulationio_pb2_grpc.pyi +14 -0
- flwr/server/__init__.py +1 -1
- flwr/server/app.py +69 -187
- flwr/server/compat/app_utils.py +50 -28
- flwr/server/fleet_event_log_interceptor.py +6 -2
- flwr/server/grid/grpc_grid.py +148 -41
- flwr/server/grid/inmemory_grid.py +5 -4
- flwr/server/serverapp/app.py +45 -17
- flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py +21 -3
- flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +102 -8
- flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +2 -5
- flwr/server/superlink/fleet/message_handler/message_handler.py +130 -19
- flwr/server/superlink/fleet/rest_rere/rest_api.py +73 -13
- flwr/server/superlink/fleet/vce/vce_api.py +6 -3
- flwr/server/superlink/linkstate/in_memory_linkstate.py +138 -43
- flwr/server/superlink/linkstate/linkstate.py +53 -20
- flwr/server/superlink/linkstate/sqlite_linkstate.py +149 -55
- flwr/server/superlink/linkstate/utils.py +33 -29
- flwr/server/superlink/serverappio/serverappio_grpc.py +4 -1
- flwr/server/superlink/serverappio/serverappio_servicer.py +230 -84
- flwr/server/superlink/simulation/simulationio_grpc.py +1 -1
- flwr/server/superlink/simulation/simulationio_servicer.py +26 -2
- flwr/server/superlink/utils.py +9 -2
- flwr/server/utils/validator.py +2 -2
- flwr/serverapp/__init__.py +15 -0
- flwr/simulation/app.py +25 -0
- flwr/simulation/run_simulation.py +17 -0
- flwr/supercore/__init__.py +15 -0
- flwr/{server/superlink → supercore}/ffs/__init__.py +2 -0
- flwr/{server/superlink → supercore}/ffs/disk_ffs.py +1 -1
- flwr/supercore/grpc_health/__init__.py +22 -0
- flwr/supercore/grpc_health/simple_health_servicer.py +38 -0
- flwr/supercore/license_plugin/__init__.py +22 -0
- flwr/supercore/license_plugin/license_plugin.py +26 -0
- flwr/supercore/object_store/__init__.py +24 -0
- flwr/supercore/object_store/in_memory_object_store.py +229 -0
- flwr/supercore/object_store/object_store.py +170 -0
- flwr/supercore/object_store/object_store_factory.py +44 -0
- flwr/supercore/object_store/utils.py +43 -0
- flwr/supercore/scheduler/__init__.py +22 -0
- flwr/supercore/scheduler/plugin.py +71 -0
- flwr/{client/nodestate/nodestate.py → supercore/utils.py} +14 -13
- flwr/superexec/deployment.py +7 -4
- flwr/superexec/exec_event_log_interceptor.py +8 -4
- flwr/superexec/exec_grpc.py +25 -5
- flwr/superexec/exec_license_interceptor.py +82 -0
- flwr/superexec/exec_servicer.py +135 -24
- flwr/superexec/exec_user_auth_interceptor.py +45 -8
- flwr/superexec/executor.py +5 -1
- flwr/superexec/simulation.py +8 -3
- flwr/superlink/__init__.py +15 -0
- flwr/{client/supernode → supernode}/__init__.py +0 -7
- flwr/supernode/cli/__init__.py +24 -0
- flwr/{client/supernode/app.py → supernode/cli/flower_supernode.py} +3 -19
- flwr/supernode/cli/flwr_clientapp.py +88 -0
- flwr/supernode/nodestate/in_memory_nodestate.py +199 -0
- flwr/supernode/nodestate/nodestate.py +227 -0
- flwr/supernode/runtime/__init__.py +15 -0
- flwr/{client/clientapp/app.py → supernode/runtime/run_clientapp.py} +135 -89
- flwr/supernode/scheduler/__init__.py +22 -0
- flwr/supernode/scheduler/simple_clientapp_scheduler_plugin.py +49 -0
- flwr/supernode/servicer/__init__.py +15 -0
- flwr/supernode/servicer/clientappio/__init__.py +22 -0
- flwr/supernode/servicer/clientappio/clientappio_servicer.py +303 -0
- flwr/supernode/start_client_internal.py +589 -0
- {flwr-1.18.0.dist-info → flwr-1.20.0.dist-info}/METADATA +6 -4
- {flwr-1.18.0.dist-info → flwr-1.20.0.dist-info}/RECORD +171 -123
- {flwr-1.18.0.dist-info → flwr-1.20.0.dist-info}/WHEEL +1 -1
- {flwr-1.18.0.dist-info → flwr-1.20.0.dist-info}/entry_points.txt +2 -2
- flwr/client/clientapp/clientappio_servicer.py +0 -244
- flwr/client/heartbeat.py +0 -74
- flwr/client/nodestate/in_memory_nodestate.py +0 -38
- /flwr/{client → compat/client}/grpc_client/__init__.py +0 -0
- /flwr/{client → compat/client}/grpc_client/connection.py +0 -0
- /flwr/{server/superlink → supercore}/ffs/ffs.py +0 -0
- /flwr/{server/superlink → supercore}/ffs/ffs_factory.py +0 -0
- /flwr/{client → supernode}/nodestate/__init__.py +0 -0
- /flwr/{client → supernode}/nodestate/nodestate_factory.py +0 -0
flwr/cli/new/new.py
CHANGED
|
@@ -271,28 +271,36 @@ def new(
|
|
|
271
271
|
|
|
272
272
|
prompt = typer.style(
|
|
273
273
|
"🎊 Flower App creation successful.\n\n"
|
|
274
|
-
"To run your Flower App,
|
|
274
|
+
"To run your Flower App, first install its dependencies:\n\n",
|
|
275
275
|
fg=typer.colors.GREEN,
|
|
276
276
|
bold=True,
|
|
277
277
|
)
|
|
278
278
|
|
|
279
279
|
_add = " huggingface-cli login\n" if llm_challenge_str else ""
|
|
280
|
+
|
|
280
281
|
prompt += typer.style(
|
|
281
|
-
|
|
282
|
+
f" cd {package_name} && pip install -e .\n" + _add + "\n",
|
|
282
283
|
fg=typer.colors.BRIGHT_CYAN,
|
|
283
284
|
bold=True,
|
|
284
285
|
)
|
|
285
286
|
|
|
286
287
|
prompt += typer.style(
|
|
287
|
-
"
|
|
288
|
+
"then, run the app:\n\n ",
|
|
288
289
|
fg=typer.colors.GREEN,
|
|
289
290
|
bold=True,
|
|
290
291
|
)
|
|
291
292
|
|
|
292
293
|
prompt += typer.style(
|
|
293
|
-
|
|
294
|
+
"\tflwr run .\n\n",
|
|
294
295
|
fg=typer.colors.BRIGHT_CYAN,
|
|
295
296
|
bold=True,
|
|
296
297
|
)
|
|
297
298
|
|
|
299
|
+
prompt += typer.style(
|
|
300
|
+
"💡 Check the README in your app directory to learn how to\n"
|
|
301
|
+
"customize it and how to run it using the Deployment Runtime.\n",
|
|
302
|
+
fg=typer.colors.GREEN,
|
|
303
|
+
bold=True,
|
|
304
|
+
)
|
|
305
|
+
|
|
298
306
|
print(prompt)
|
|
@@ -21,6 +21,8 @@ Project dependencies are defined in `pyproject.toml`. Install them in an activat
|
|
|
21
21
|
pip install -e .
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
> **Tip:** Learn how to configure your `pyproject.toml` file for Flower apps in [this guide](https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html).
|
|
25
|
+
|
|
24
26
|
## Experimental setup
|
|
25
27
|
|
|
26
28
|
The dataset is divided into $num_clients partitions in an IID fashion, a partition is assigned to each ClientApp.
|
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Install dependencies and project
|
|
4
4
|
|
|
5
|
+
The dependencies are listed in the `pyproject.toml` and you can install them as follows:
|
|
6
|
+
|
|
5
7
|
```bash
|
|
6
8
|
pip install -e .
|
|
7
9
|
```
|
|
8
10
|
|
|
11
|
+
> **Tip:** Your `pyproject.toml` file can define more than just the dependencies of your Flower app. You can also use it to specify hyperparameters for your runs and control which Flower Runtime is used. By default, it uses the Simulation Runtime, but you can switch to the Deployment Runtime when needed.
|
|
12
|
+
> Learn more in the [TOML configuration guide](https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html).
|
|
13
|
+
|
|
9
14
|
## Run with the Simulation Engine
|
|
10
15
|
|
|
11
16
|
In the `$project_name` directory, use `flwr run` to run a local simulation:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""$project_name: A Flower Baseline."""
|
|
2
2
|
|
|
3
3
|
import torch
|
|
4
|
-
|
|
5
4
|
from flwr.client import ClientApp, NumPyClient
|
|
6
5
|
from flwr.common import Context
|
|
6
|
+
|
|
7
7
|
from $import_name.dataset import load_data
|
|
8
8
|
from $import_name.model import Net, get_weights, set_weights, test, train
|
|
9
9
|
|
|
@@ -76,5 +76,5 @@ def get_weights(net):
|
|
|
76
76
|
def set_weights(net, parameters):
|
|
77
77
|
"""Apply parameters to an existing model."""
|
|
78
78
|
params_dict = zip(net.state_dict().keys(), parameters)
|
|
79
|
-
state_dict = OrderedDict({k: torch.
|
|
79
|
+
state_dict = OrderedDict({k: torch.from_numpy(v) for k, v in params_dict})
|
|
80
80
|
net.load_state_dict(state_dict, strict=True)
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"""$project_name: A Flower Baseline."""
|
|
2
2
|
|
|
3
|
-
from typing import List, Tuple
|
|
4
|
-
|
|
5
3
|
from flwr.common import Context, Metrics, ndarrays_to_parameters
|
|
6
4
|
from flwr.server import ServerApp, ServerAppComponents, ServerConfig
|
|
7
5
|
from flwr.server.strategy import FedAvg
|
|
6
|
+
|
|
8
7
|
from $import_name.model import Net, get_weights
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
# Define metric aggregation function
|
|
12
|
-
def weighted_average(metrics:
|
|
11
|
+
def weighted_average(metrics: list[tuple[int, Metrics]]) -> Metrics:
|
|
13
12
|
"""Do weighted average of accuracy metric."""
|
|
14
13
|
# Multiply accuracy of each client by number of examples used
|
|
15
14
|
accuracies = [num_examples * float(m["accuracy"]) for num_examples, m in metrics]
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,11 +12,12 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"flwr-datasets[vision]>=0.5.0",
|
|
13
|
-
"torch==2.
|
|
14
|
-
"torchvision==0.
|
|
19
|
+
"torch==2.7.1",
|
|
20
|
+
"torchvision==0.22.1",
|
|
15
21
|
]
|
|
16
22
|
|
|
17
23
|
[tool.hatch.metadata]
|
|
@@ -23,28 +29,23 @@ dev = [
|
|
|
23
29
|
"black==24.2.0",
|
|
24
30
|
"docformatter==1.7.5",
|
|
25
31
|
"mypy==1.8.0",
|
|
26
|
-
"pylint==3.
|
|
27
|
-
"
|
|
28
|
-
"pytest==6.2.4",
|
|
32
|
+
"pylint==3.3.1",
|
|
33
|
+
"pytest==7.4.4",
|
|
29
34
|
"pytest-watch==4.2.0",
|
|
30
|
-
"ruff==0.
|
|
35
|
+
"ruff==0.4.5",
|
|
31
36
|
"types-requests==2.31.0.20240125",
|
|
32
37
|
]
|
|
33
38
|
|
|
34
39
|
[tool.isort]
|
|
35
40
|
profile = "black"
|
|
36
|
-
known_first_party = ["flwr"]
|
|
37
41
|
|
|
38
42
|
[tool.black]
|
|
39
43
|
line-length = 88
|
|
40
|
-
target-version = ["
|
|
44
|
+
target-version = ["py310", "py311", "py312"]
|
|
41
45
|
|
|
42
46
|
[tool.pytest.ini_options]
|
|
43
47
|
minversion = "6.2"
|
|
44
48
|
addopts = "-qq"
|
|
45
|
-
testpaths = [
|
|
46
|
-
"flwr_baselines",
|
|
47
|
-
]
|
|
48
49
|
|
|
49
50
|
[tool.mypy]
|
|
50
51
|
ignore_missing_imports = true
|
|
@@ -82,11 +83,8 @@ wrap-summaries = 88
|
|
|
82
83
|
wrap-descriptions = 88
|
|
83
84
|
|
|
84
85
|
[tool.ruff]
|
|
85
|
-
target-version = "
|
|
86
|
+
target-version = "py310"
|
|
86
87
|
line-length = 88
|
|
87
|
-
select = ["D", "E", "F", "W", "B", "ISC", "C4"]
|
|
88
|
-
fixable = ["D", "E", "F", "W", "B", "ISC", "C4"]
|
|
89
|
-
ignore = ["B024", "B027"]
|
|
90
88
|
exclude = [
|
|
91
89
|
".bzr",
|
|
92
90
|
".direnv",
|
|
@@ -111,7 +109,12 @@ exclude = [
|
|
|
111
109
|
"proto",
|
|
112
110
|
]
|
|
113
111
|
|
|
114
|
-
[tool.ruff.
|
|
112
|
+
[tool.ruff.lint]
|
|
113
|
+
select = ["D", "E", "F", "W", "B", "ISC", "C4", "UP"]
|
|
114
|
+
fixable = ["D", "E", "F", "W", "B", "ISC", "C4", "UP"]
|
|
115
|
+
ignore = ["B024", "B027", "D205", "D209"]
|
|
116
|
+
|
|
117
|
+
[tool.ruff.lint.pydocstyle]
|
|
115
118
|
convention = "numpy"
|
|
116
119
|
|
|
117
120
|
[tool.hatch.build.targets.wheel]
|
|
@@ -120,18 +123,23 @@ packages = ["."]
|
|
|
120
123
|
[tool.flwr.app]
|
|
121
124
|
publisher = "$username"
|
|
122
125
|
|
|
126
|
+
# Point to your ServerApp and ClientApp objects
|
|
127
|
+
# Format: "<module>:<object>"
|
|
123
128
|
[tool.flwr.app.components]
|
|
124
129
|
serverapp = "$import_name.server_app:app"
|
|
125
130
|
clientapp = "$import_name.client_app:app"
|
|
126
131
|
|
|
132
|
+
# Custom config values accessible via `context.run_config`
|
|
127
133
|
[tool.flwr.app.config]
|
|
128
134
|
num-server-rounds = 3
|
|
129
135
|
fraction-fit = 0.5
|
|
130
136
|
local-epochs = 1
|
|
131
137
|
|
|
138
|
+
# Default federation to use when running the app
|
|
132
139
|
[tool.flwr.federations]
|
|
133
140
|
default = "local-simulation"
|
|
134
141
|
|
|
142
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
135
143
|
[tool.flwr.federations.local-simulation]
|
|
136
144
|
options.num-supernodes = 10
|
|
137
145
|
options.backend.client-resources.num-cpus = 2
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,8 +12,9 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"flwr-datasets>=0.5.0",
|
|
13
19
|
"torch==2.4.0",
|
|
14
20
|
"trl==0.8.1",
|
|
@@ -27,10 +33,13 @@ packages = ["."]
|
|
|
27
33
|
[tool.flwr.app]
|
|
28
34
|
publisher = "$username"
|
|
29
35
|
|
|
36
|
+
# Point to your ServerApp and ClientApp objects
|
|
37
|
+
# Format: "<module>:<object>"
|
|
30
38
|
[tool.flwr.app.components]
|
|
31
39
|
serverapp = "$import_name.server_app:app"
|
|
32
40
|
clientapp = "$import_name.client_app:app"
|
|
33
41
|
|
|
42
|
+
# Custom config values accessible via `context.run_config`
|
|
34
43
|
[tool.flwr.app.config]
|
|
35
44
|
model.name = "mistralai/Mistral-7B-v0.3"
|
|
36
45
|
model.quantization = 4
|
|
@@ -56,12 +65,15 @@ strategy.fraction-fit = $fraction_fit
|
|
|
56
65
|
strategy.fraction-evaluate = 0.0
|
|
57
66
|
num-server-rounds = 200
|
|
58
67
|
|
|
68
|
+
# Dataset config (static for FlowerTune LLM Leaderboard)
|
|
59
69
|
[tool.flwr.app.config.static]
|
|
60
70
|
dataset.name = "$dataset_name"
|
|
61
71
|
|
|
72
|
+
# Default federation to use when running the app
|
|
62
73
|
[tool.flwr.federations]
|
|
63
74
|
default = "local-simulation"
|
|
64
75
|
|
|
76
|
+
# Local simulation federation with $num_clients virtual SuperNodes
|
|
65
77
|
[tool.flwr.federations.local-simulation]
|
|
66
78
|
options.num-supernodes = $num_clients
|
|
67
79
|
options.backend.client-resources.num-cpus = 6
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,10 +12,11 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"flwr-datasets>=0.5.0",
|
|
13
|
-
"torch==2.
|
|
19
|
+
"torch==2.7.1",
|
|
14
20
|
"transformers>=4.30.0,<5.0",
|
|
15
21
|
"evaluate>=0.4.0,<1.0",
|
|
16
22
|
"datasets>=2.0.0, <3.0",
|
|
@@ -23,10 +29,13 @@ packages = ["."]
|
|
|
23
29
|
[tool.flwr.app]
|
|
24
30
|
publisher = "$username"
|
|
25
31
|
|
|
32
|
+
# Point to your ServerApp and ClientApp objects
|
|
33
|
+
# Format: "<module>:<object>"
|
|
26
34
|
[tool.flwr.app.components]
|
|
27
35
|
serverapp = "$import_name.server_app:app"
|
|
28
36
|
clientapp = "$import_name.client_app:app"
|
|
29
37
|
|
|
38
|
+
# Custom config values accessible via `context.run_config`
|
|
30
39
|
[tool.flwr.app.config]
|
|
31
40
|
num-server-rounds = 3
|
|
32
41
|
fraction-fit = 0.5
|
|
@@ -34,13 +43,23 @@ local-epochs = 1
|
|
|
34
43
|
model-name = "prajjwal1/bert-tiny" # Set a larger model if you have access to more GPU resources
|
|
35
44
|
num-labels = 2
|
|
36
45
|
|
|
46
|
+
# Default federation to use when running the app
|
|
37
47
|
[tool.flwr.federations]
|
|
38
48
|
default = "localhost"
|
|
39
49
|
|
|
50
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
40
51
|
[tool.flwr.federations.localhost]
|
|
41
52
|
options.num-supernodes = 10
|
|
42
53
|
|
|
54
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
55
|
+
# making use of GPUs
|
|
43
56
|
[tool.flwr.federations.localhost-gpu]
|
|
44
57
|
options.num-supernodes = 10
|
|
45
58
|
options.backend.client-resources.num-cpus = 4 # each ClientApp assumes to use 4CPUs
|
|
46
59
|
options.backend.client-resources.num-gpus = 0.25 # at most 4 ClientApps will run in a given GPU
|
|
60
|
+
|
|
61
|
+
# Remote federation example for use with SuperLink
|
|
62
|
+
[tool.flwr.federations.remote-federation]
|
|
63
|
+
address = "<SUPERLINK-ADDRESS>:<PORT>"
|
|
64
|
+
insecure = true # Remove this line to enable TLS
|
|
65
|
+
# root-certificates = "<PATH/TO/ca.crt>" # For TLS setup
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,8 +12,9 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"jax==0.4.30",
|
|
13
19
|
"jaxlib==0.4.30",
|
|
14
20
|
"scikit-learn==1.6.1",
|
|
@@ -20,16 +26,27 @@ packages = ["."]
|
|
|
20
26
|
[tool.flwr.app]
|
|
21
27
|
publisher = "$username"
|
|
22
28
|
|
|
29
|
+
# Point to your ServerApp and ClientApp objects
|
|
30
|
+
# Format: "<module>:<object>"
|
|
23
31
|
[tool.flwr.app.components]
|
|
24
32
|
serverapp = "$import_name.server_app:app"
|
|
25
33
|
clientapp = "$import_name.client_app:app"
|
|
26
34
|
|
|
35
|
+
# Custom config values accessible via `context.run_config`
|
|
27
36
|
[tool.flwr.app.config]
|
|
28
37
|
num-server-rounds = 3
|
|
29
38
|
input-dim = 3
|
|
30
39
|
|
|
40
|
+
# Default federation to use when running the app
|
|
31
41
|
[tool.flwr.federations]
|
|
32
42
|
default = "local-simulation"
|
|
33
43
|
|
|
44
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
34
45
|
[tool.flwr.federations.local-simulation]
|
|
35
46
|
options.num-supernodes = 10
|
|
47
|
+
|
|
48
|
+
# Remote federation example for use with SuperLink
|
|
49
|
+
[tool.flwr.federations.remote-federation]
|
|
50
|
+
address = "<SUPERLINK-ADDRESS>:<PORT>"
|
|
51
|
+
insecure = true # Remove this line to enable TLS
|
|
52
|
+
# root-certificates = "<PATH/TO/ca.crt>" # For TLS setup
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,10 +12,11 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"flwr-datasets[vision]>=0.5.0",
|
|
13
|
-
"mlx==0.
|
|
19
|
+
"mlx==0.26.5",
|
|
14
20
|
]
|
|
15
21
|
|
|
16
22
|
[tool.hatch.build.targets.wheel]
|
|
@@ -19,10 +25,13 @@ packages = ["."]
|
|
|
19
25
|
[tool.flwr.app]
|
|
20
26
|
publisher = "$username"
|
|
21
27
|
|
|
28
|
+
# Point to your ServerApp and ClientApp objects
|
|
29
|
+
# Format: "<module>:<object>"
|
|
22
30
|
[tool.flwr.app.components]
|
|
23
31
|
serverapp = "$import_name.server_app:app"
|
|
24
32
|
clientapp = "$import_name.client_app:app"
|
|
25
33
|
|
|
34
|
+
# Custom config values accessible via `context.run_config`
|
|
26
35
|
[tool.flwr.app.config]
|
|
27
36
|
num-server-rounds = 3
|
|
28
37
|
local-epochs = 1
|
|
@@ -32,8 +41,16 @@ hidden-dim = 32
|
|
|
32
41
|
batch-size = 256
|
|
33
42
|
lr = 0.1
|
|
34
43
|
|
|
44
|
+
# Default federation to use when running the app
|
|
35
45
|
[tool.flwr.federations]
|
|
36
46
|
default = "local-simulation"
|
|
37
47
|
|
|
48
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
38
49
|
[tool.flwr.federations.local-simulation]
|
|
39
50
|
options.num-supernodes = 10
|
|
51
|
+
|
|
52
|
+
# Remote federation example for use with SuperLink
|
|
53
|
+
[tool.flwr.federations.remote-federation]
|
|
54
|
+
address = "<SUPERLINK-ADDRESS>:<PORT>"
|
|
55
|
+
insecure = true # Remove this line to enable TLS
|
|
56
|
+
# root-certificates = "<PATH/TO/ca.crt>" # For TLS setup
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,8 +12,9 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"numpy>=2.0.2",
|
|
13
19
|
]
|
|
14
20
|
|
|
@@ -18,15 +24,26 @@ packages = ["."]
|
|
|
18
24
|
[tool.flwr.app]
|
|
19
25
|
publisher = "$username"
|
|
20
26
|
|
|
27
|
+
# Point to your ServerApp and ClientApp objects
|
|
28
|
+
# Format: "<module>:<object>"
|
|
21
29
|
[tool.flwr.app.components]
|
|
22
30
|
serverapp = "$import_name.server_app:app"
|
|
23
31
|
clientapp = "$import_name.client_app:app"
|
|
24
32
|
|
|
33
|
+
# Custom config values accessible via `context.run_config`
|
|
25
34
|
[tool.flwr.app.config]
|
|
26
35
|
num-server-rounds = 3
|
|
27
36
|
|
|
37
|
+
# Default federation to use when running the app
|
|
28
38
|
[tool.flwr.federations]
|
|
29
39
|
default = "local-simulation"
|
|
30
40
|
|
|
41
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
31
42
|
[tool.flwr.federations.local-simulation]
|
|
32
43
|
options.num-supernodes = 10
|
|
44
|
+
|
|
45
|
+
# Remote federation example for use with SuperLink
|
|
46
|
+
[tool.flwr.federations.remote-federation]
|
|
47
|
+
address = "<SUPERLINK-ADDRESS>:<PORT>"
|
|
48
|
+
insecure = true # Remove this line to enable TLS
|
|
49
|
+
# root-certificates = "<PATH/TO/ca.crt>" # For TLS setup
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,11 +12,12 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"flwr-datasets[vision]>=0.5.0",
|
|
13
|
-
"torch==2.
|
|
14
|
-
"torchvision==0.
|
|
19
|
+
"torch==2.7.1",
|
|
20
|
+
"torchvision==0.22.1",
|
|
15
21
|
]
|
|
16
22
|
|
|
17
23
|
[tool.hatch.build.targets.wheel]
|
|
@@ -20,17 +26,28 @@ packages = ["."]
|
|
|
20
26
|
[tool.flwr.app]
|
|
21
27
|
publisher = "$username"
|
|
22
28
|
|
|
29
|
+
# Point to your ServerApp and ClientApp objects
|
|
30
|
+
# Format: "<module>:<object>"
|
|
23
31
|
[tool.flwr.app.components]
|
|
24
32
|
serverapp = "$import_name.server_app:app"
|
|
25
33
|
clientapp = "$import_name.client_app:app"
|
|
26
34
|
|
|
35
|
+
# Custom config values accessible via `context.run_config`
|
|
27
36
|
[tool.flwr.app.config]
|
|
28
37
|
num-server-rounds = 3
|
|
29
38
|
fraction-fit = 0.5
|
|
30
39
|
local-epochs = 1
|
|
31
40
|
|
|
41
|
+
# Default federation to use when running the app
|
|
32
42
|
[tool.flwr.federations]
|
|
33
43
|
default = "local-simulation"
|
|
34
44
|
|
|
45
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
35
46
|
[tool.flwr.federations.local-simulation]
|
|
36
47
|
options.num-supernodes = 10
|
|
48
|
+
|
|
49
|
+
# Remote federation example for use with SuperLink
|
|
50
|
+
[tool.flwr.federations.remote-federation]
|
|
51
|
+
address = "<SUPERLINK-ADDRESS>:<PORT>"
|
|
52
|
+
insecure = true # Remove this line to enable TLS
|
|
53
|
+
# root-certificates = "<PATH/TO/ca.crt>" # For TLS setup
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,8 +12,9 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"flwr-datasets[vision]>=0.5.0",
|
|
13
19
|
"scikit-learn>=1.6.1",
|
|
14
20
|
]
|
|
@@ -19,17 +25,28 @@ packages = ["."]
|
|
|
19
25
|
[tool.flwr.app]
|
|
20
26
|
publisher = "$username"
|
|
21
27
|
|
|
28
|
+
# Point to your ServerApp and ClientApp objects
|
|
29
|
+
# Format: "<module>:<object>"
|
|
22
30
|
[tool.flwr.app.components]
|
|
23
31
|
serverapp = "$import_name.server_app:app"
|
|
24
32
|
clientapp = "$import_name.client_app:app"
|
|
25
33
|
|
|
34
|
+
# Custom config values accessible via `context.run_config`
|
|
26
35
|
[tool.flwr.app.config]
|
|
27
36
|
num-server-rounds = 3
|
|
28
37
|
penalty = "l2"
|
|
29
38
|
local-epochs = 1
|
|
30
39
|
|
|
40
|
+
# Default federation to use when running the app
|
|
31
41
|
[tool.flwr.federations]
|
|
32
42
|
default = "local-simulation"
|
|
33
43
|
|
|
44
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
34
45
|
[tool.flwr.federations.local-simulation]
|
|
35
46
|
options.num-supernodes = 10
|
|
47
|
+
|
|
48
|
+
# Remote federation example for use with SuperLink
|
|
49
|
+
[tool.flwr.federations.remote-federation]
|
|
50
|
+
address = "<SUPERLINK-ADDRESS>:<PORT>"
|
|
51
|
+
insecure = true # Remove this line to enable TLS
|
|
52
|
+
# root-certificates = "<PATH/TO/ca.crt>" # For TLS setup
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# For a full TOML configuration guide, check the Flower docs:
|
|
3
|
+
# https://flower.ai/docs/framework/how-to-configure-pyproject-toml.html
|
|
4
|
+
# =====================================================================
|
|
5
|
+
|
|
1
6
|
[build-system]
|
|
2
7
|
requires = ["hatchling"]
|
|
3
8
|
build-backend = "hatchling.build"
|
|
@@ -7,8 +12,9 @@ name = "$package_name"
|
|
|
7
12
|
version = "1.0.0"
|
|
8
13
|
description = ""
|
|
9
14
|
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
10
16
|
dependencies = [
|
|
11
|
-
"flwr[simulation]>=1.
|
|
17
|
+
"flwr[simulation]>=1.20.0",
|
|
12
18
|
"flwr-datasets[vision]>=0.5.0",
|
|
13
19
|
"tensorflow>=2.11.1,<2.18.0",
|
|
14
20
|
]
|
|
@@ -19,18 +25,29 @@ packages = ["."]
|
|
|
19
25
|
[tool.flwr.app]
|
|
20
26
|
publisher = "$username"
|
|
21
27
|
|
|
28
|
+
# Point to your ServerApp and ClientApp objects
|
|
29
|
+
# Format: "<module>:<object>"
|
|
22
30
|
[tool.flwr.app.components]
|
|
23
31
|
serverapp = "$import_name.server_app:app"
|
|
24
32
|
clientapp = "$import_name.client_app:app"
|
|
25
33
|
|
|
34
|
+
# Custom config values accessible via `context.run_config`
|
|
26
35
|
[tool.flwr.app.config]
|
|
27
36
|
num-server-rounds = 3
|
|
28
37
|
local-epochs = 1
|
|
29
38
|
batch-size = 32
|
|
30
39
|
verbose = false
|
|
31
40
|
|
|
41
|
+
# Default federation to use when running the app
|
|
32
42
|
[tool.flwr.federations]
|
|
33
43
|
default = "local-simulation"
|
|
34
44
|
|
|
45
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
35
46
|
[tool.flwr.federations.local-simulation]
|
|
36
47
|
options.num-supernodes = 10
|
|
48
|
+
|
|
49
|
+
# Remote federation example for use with SuperLink
|
|
50
|
+
[tool.flwr.federations.remote-federation]
|
|
51
|
+
address = "<SUPERLINK-ADDRESS>:<PORT>"
|
|
52
|
+
insecure = true # Remove this line to enable TLS
|
|
53
|
+
# root-certificates = "<PATH/TO/ca.crt>" # For TLS setup
|