flwr 1.19.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/cli/build.py +15 -5
- 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/pyproject.baseline.toml.tpl +14 -3
- 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 +45 -38
- flwr/cli/utils.py +12 -5
- flwr/client/grpc_adapter_client/connection.py +11 -4
- flwr/client/grpc_rere_client/connection.py +92 -117
- flwr/client/rest_client/connection.py +131 -164
- flwr/common/constant.py +3 -1
- flwr/common/exit/exit_code.py +16 -1
- flwr/common/grpc.py +12 -1
- flwr/common/{inflatable_grpc_utils.py → inflatable_protobuf_utils.py} +52 -10
- flwr/common/inflatable_utils.py +191 -24
- flwr/common/record/array.py +101 -22
- flwr/common/record/arraychunk.py +59 -0
- flwr/common/serde.py +0 -28
- flwr/compat/client/app.py +14 -31
- 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 +12 -20
- flwr/proto/fleet_pb2.pyi +6 -36
- flwr/proto/serverappio_pb2.py +8 -31
- flwr/proto/serverappio_pb2.pyi +0 -152
- flwr/proto/serverappio_pb2_grpc.py +39 -38
- flwr/proto/serverappio_pb2_grpc.pyi +21 -20
- flwr/server/app.py +1 -1
- flwr/server/fleet_event_log_interceptor.py +4 -0
- flwr/server/grid/grpc_grid.py +91 -54
- flwr/server/serverapp/app.py +27 -17
- flwr/server/superlink/fleet/grpc_adapter/grpc_adapter_servicer.py +8 -0
- flwr/server/superlink/fleet/grpc_rere/fleet_servicer.py +1 -1
- flwr/server/superlink/fleet/grpc_rere/server_interceptor.py +2 -5
- flwr/server/superlink/fleet/message_handler/message_handler.py +10 -16
- flwr/server/superlink/fleet/rest_rere/rest_api.py +1 -2
- flwr/server/superlink/serverappio/serverappio_grpc.py +1 -1
- flwr/server/superlink/serverappio/serverappio_servicer.py +35 -43
- flwr/server/superlink/simulation/simulationio_grpc.py +1 -1
- flwr/server/superlink/simulation/simulationio_servicer.py +1 -1
- flwr/server/superlink/utils.py +0 -35
- flwr/simulation/app.py +8 -0
- flwr/simulation/run_simulation.py +17 -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/in_memory_object_store.py +31 -31
- flwr/supercore/object_store/object_store.py +20 -42
- flwr/supercore/object_store/utils.py +43 -0
- flwr/supercore/scheduler/__init__.py +22 -0
- flwr/supercore/scheduler/plugin.py +71 -0
- flwr/supercore/utils.py +32 -0
- flwr/superexec/deployment.py +1 -2
- flwr/superexec/exec_event_log_interceptor.py +4 -0
- flwr/superexec/exec_grpc.py +18 -2
- flwr/superexec/exec_license_interceptor.py +82 -0
- flwr/superexec/exec_servicer.py +10 -1
- flwr/superexec/exec_user_auth_interceptor.py +10 -2
- flwr/superexec/executor.py +1 -1
- flwr/superexec/simulation.py +1 -2
- flwr/supernode/cli/flower_supernode.py +0 -7
- flwr/supernode/cli/flwr_clientapp.py +10 -3
- flwr/supernode/nodestate/in_memory_nodestate.py +11 -2
- flwr/supernode/nodestate/nodestate.py +15 -0
- flwr/supernode/runtime/run_clientapp.py +110 -33
- flwr/supernode/scheduler/__init__.py +22 -0
- flwr/supernode/scheduler/simple_clientapp_scheduler_plugin.py +49 -0
- flwr/supernode/servicer/clientappio/__init__.py +1 -3
- flwr/supernode/servicer/clientappio/clientappio_servicer.py +223 -164
- flwr/supernode/start_client_internal.py +202 -104
- {flwr-1.19.0.dist-info → flwr-1.20.0.dist-info}/METADATA +2 -1
- {flwr-1.19.0.dist-info → flwr-1.20.0.dist-info}/RECORD +93 -78
- flwr/common/inflatable_rest_utils.py +0 -99
- /flwr/{server/superlink → supercore}/ffs/__init__.py +0 -0
- /flwr/{server/superlink → supercore}/ffs/ffs.py +0 -0
- /flwr/{server/superlink → supercore}/ffs/ffs_factory.py +0 -0
- {flwr-1.19.0.dist-info → flwr-1.20.0.dist-info}/WHEEL +0 -0
- {flwr-1.19.0.dist-info → flwr-1.20.0.dist-info}/entry_points.txt +0 -0
flwr/cli/build.py
CHANGED
|
@@ -25,7 +25,12 @@ import pathspec
|
|
|
25
25
|
import tomli_w
|
|
26
26
|
import typer
|
|
27
27
|
|
|
28
|
-
from flwr.common.constant import
|
|
28
|
+
from flwr.common.constant import (
|
|
29
|
+
FAB_ALLOWED_EXTENSIONS,
|
|
30
|
+
FAB_DATE,
|
|
31
|
+
FAB_HASH_TRUNCATION,
|
|
32
|
+
FAB_MAX_SIZE,
|
|
33
|
+
)
|
|
29
34
|
|
|
30
35
|
from .config_utils import load as load_toml
|
|
31
36
|
from .config_utils import load_and_validate
|
|
@@ -57,7 +62,7 @@ def build(
|
|
|
57
62
|
Optional[Path],
|
|
58
63
|
typer.Option(help="Path of the Flower App to bundle into a FAB"),
|
|
59
64
|
] = None,
|
|
60
|
-
) ->
|
|
65
|
+
) -> None:
|
|
61
66
|
"""Build a Flower App into a Flower App Bundle (FAB).
|
|
62
67
|
|
|
63
68
|
You can run ``flwr build`` without any arguments to bundle the app located in the
|
|
@@ -119,8 +124,6 @@ def build(
|
|
|
119
124
|
f"🎊 Successfully built {fab_filename}", fg=typer.colors.GREEN, bold=True
|
|
120
125
|
)
|
|
121
126
|
|
|
122
|
-
return fab_filename, fab_hash
|
|
123
|
-
|
|
124
127
|
|
|
125
128
|
def build_fab(app: Path) -> tuple[bytes, str, dict[str, Any]]:
|
|
126
129
|
"""Build a FAB in memory and return the bytes, hash, and config.
|
|
@@ -181,7 +184,7 @@ def build_fab(app: Path) -> tuple[bytes, str, dict[str, Any]]:
|
|
|
181
184
|
# Read the file content manually
|
|
182
185
|
file_contents = file_path.read_bytes()
|
|
183
186
|
|
|
184
|
-
archive_path = str(file_path.relative_to(app))
|
|
187
|
+
archive_path = str(file_path.relative_to(app)).replace("\\", "/")
|
|
185
188
|
write_to_zip(fab_file, archive_path, file_contents)
|
|
186
189
|
|
|
187
190
|
# Calculate file info
|
|
@@ -193,6 +196,13 @@ def build_fab(app: Path) -> tuple[bytes, str, dict[str, Any]]:
|
|
|
193
196
|
write_to_zip(fab_file, ".info/CONTENT", list_file_content)
|
|
194
197
|
|
|
195
198
|
fab_bytes = fab_buffer.getvalue()
|
|
199
|
+
if len(fab_bytes) > FAB_MAX_SIZE:
|
|
200
|
+
raise ValueError(
|
|
201
|
+
f"FAB size exceeds maximum allowed size of {FAB_MAX_SIZE:,} bytes."
|
|
202
|
+
"To reduce the package size, consider ignoring unnecessary files "
|
|
203
|
+
"via your `.gitignore` file or excluding them from the build."
|
|
204
|
+
)
|
|
205
|
+
|
|
196
206
|
fab_hash = hashlib.sha256(fab_bytes).hexdigest()
|
|
197
207
|
|
|
198
208
|
return fab_bytes, fab_hash, config
|
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,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]
|
|
@@ -117,18 +123,23 @@ packages = ["."]
|
|
|
117
123
|
[tool.flwr.app]
|
|
118
124
|
publisher = "$username"
|
|
119
125
|
|
|
126
|
+
# Point to your ServerApp and ClientApp objects
|
|
127
|
+
# Format: "<module>:<object>"
|
|
120
128
|
[tool.flwr.app.components]
|
|
121
129
|
serverapp = "$import_name.server_app:app"
|
|
122
130
|
clientapp = "$import_name.client_app:app"
|
|
123
131
|
|
|
132
|
+
# Custom config values accessible via `context.run_config`
|
|
124
133
|
[tool.flwr.app.config]
|
|
125
134
|
num-server-rounds = 3
|
|
126
135
|
fraction-fit = 0.5
|
|
127
136
|
local-epochs = 1
|
|
128
137
|
|
|
138
|
+
# Default federation to use when running the app
|
|
129
139
|
[tool.flwr.federations]
|
|
130
140
|
default = "local-simulation"
|
|
131
141
|
|
|
142
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
132
143
|
[tool.flwr.federations.local-simulation]
|
|
133
144
|
options.num-supernodes = 10
|
|
134
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
|
flwr/cli/run/run.py
CHANGED
|
@@ -150,50 +150,57 @@ def _run_with_exec_api(
|
|
|
150
150
|
stream: bool,
|
|
151
151
|
output_format: str,
|
|
152
152
|
) -> None:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
channel = None
|
|
154
|
+
try:
|
|
155
|
+
auth_plugin = try_obtain_cli_auth_plugin(app, federation, federation_config)
|
|
156
|
+
channel = init_channel(app, federation_config, auth_plugin)
|
|
157
|
+
stub = ExecStub(channel)
|
|
156
158
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
fab_bytes, fab_hash, config = build_fab(app)
|
|
160
|
+
fab_id, fab_version = get_metadata_from_config(config)
|
|
159
161
|
|
|
160
|
-
|
|
162
|
+
fab = Fab(fab_hash, fab_bytes)
|
|
161
163
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
# Construct a `ConfigRecord` out of a flattened `UserConfig`
|
|
165
|
+
fed_config = flatten_dict(federation_config.get("options", {}))
|
|
166
|
+
c_record = user_config_to_configrecord(fed_config)
|
|
165
167
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
)
|
|
171
|
-
with flwr_cli_grpc_exc_handler():
|
|
172
|
-
res = stub.StartRun(req)
|
|
173
|
-
|
|
174
|
-
if res.HasField("run_id"):
|
|
175
|
-
typer.secho(f"🎊 Successfully started run {res.run_id}", fg=typer.colors.GREEN)
|
|
176
|
-
else:
|
|
177
|
-
typer.secho("❌ Failed to start run", fg=typer.colors.RED)
|
|
178
|
-
raise typer.Exit(code=1)
|
|
179
|
-
|
|
180
|
-
if output_format == CliOutputFormat.JSON:
|
|
181
|
-
run_output = json.dumps(
|
|
182
|
-
{
|
|
183
|
-
"success": res.HasField("run_id"),
|
|
184
|
-
"run-id": res.run_id if res.HasField("run_id") else None,
|
|
185
|
-
"fab-id": fab_id,
|
|
186
|
-
"fab-name": fab_id.rsplit("/", maxsplit=1)[-1],
|
|
187
|
-
"fab-version": fab_version,
|
|
188
|
-
"fab-hash": fab_hash[:8],
|
|
189
|
-
"fab-filename": get_fab_filename(config, fab_hash),
|
|
190
|
-
}
|
|
168
|
+
req = StartRunRequest(
|
|
169
|
+
fab=fab_to_proto(fab),
|
|
170
|
+
override_config=user_config_to_proto(parse_config_args(config_overrides)),
|
|
171
|
+
federation_options=config_record_to_proto(c_record),
|
|
191
172
|
)
|
|
192
|
-
|
|
193
|
-
|
|
173
|
+
with flwr_cli_grpc_exc_handler():
|
|
174
|
+
res = stub.StartRun(req)
|
|
194
175
|
|
|
195
|
-
|
|
196
|
-
|
|
176
|
+
if res.HasField("run_id"):
|
|
177
|
+
typer.secho(
|
|
178
|
+
f"🎊 Successfully started run {res.run_id}", fg=typer.colors.GREEN
|
|
179
|
+
)
|
|
180
|
+
else:
|
|
181
|
+
typer.secho("❌ Failed to start run", fg=typer.colors.RED)
|
|
182
|
+
raise typer.Exit(code=1)
|
|
183
|
+
|
|
184
|
+
if output_format == CliOutputFormat.JSON:
|
|
185
|
+
run_output = json.dumps(
|
|
186
|
+
{
|
|
187
|
+
"success": res.HasField("run_id"),
|
|
188
|
+
"run-id": res.run_id if res.HasField("run_id") else None,
|
|
189
|
+
"fab-id": fab_id,
|
|
190
|
+
"fab-name": fab_id.rsplit("/", maxsplit=1)[-1],
|
|
191
|
+
"fab-version": fab_version,
|
|
192
|
+
"fab-hash": fab_hash[:8],
|
|
193
|
+
"fab-filename": get_fab_filename(config, fab_hash),
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
restore_output()
|
|
197
|
+
Console().print_json(run_output)
|
|
198
|
+
|
|
199
|
+
if stream:
|
|
200
|
+
start_stream(res.run_id, channel, CONN_REFRESH_PERIOD)
|
|
201
|
+
finally:
|
|
202
|
+
if channel:
|
|
203
|
+
channel.close()
|
|
197
204
|
|
|
198
205
|
|
|
199
206
|
def _run_without_exec_api(
|