flwr 1.19.0__py3-none-any.whl → 1.21.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 +4 -1
- flwr/app/__init__.py +28 -0
- flwr/app/exception.py +31 -0
- flwr/cli/auth_plugin/oidc_cli_plugin.py +4 -4
- flwr/cli/build.py +15 -5
- flwr/cli/cli_user_auth_interceptor.py +1 -1
- flwr/cli/config_utils.py +3 -3
- flwr/cli/constant.py +25 -8
- flwr/cli/log.py +9 -9
- flwr/cli/login/login.py +3 -3
- flwr/cli/ls.py +5 -5
- flwr/cli/new/new.py +23 -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/__init__.pytorch_msg_api.py.tpl +1 -0
- flwr/cli/new/templates/app/code/client.pytorch_msg_api.py.tpl +80 -0
- flwr/cli/new/templates/app/code/server.pytorch_msg_api.py.tpl +41 -0
- flwr/cli/new/templates/app/code/task.pytorch_msg_api.py.tpl +98 -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.pytorch_msg_api.toml.tpl +53 -0
- 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 +53 -50
- flwr/cli/stop.py +7 -4
- flwr/cli/utils.py +29 -11
- flwr/client/grpc_adapter_client/connection.py +11 -4
- flwr/client/grpc_rere_client/connection.py +93 -129
- flwr/client/rest_client/connection.py +134 -164
- flwr/clientapp/__init__.py +10 -0
- flwr/clientapp/mod/__init__.py +26 -0
- flwr/clientapp/mod/centraldp_mods.py +132 -0
- flwr/common/args.py +20 -6
- flwr/common/auth_plugin/__init__.py +4 -4
- flwr/common/auth_plugin/auth_plugin.py +7 -7
- flwr/common/constant.py +26 -5
- flwr/common/event_log_plugin/event_log_plugin.py +1 -1
- flwr/common/exit/__init__.py +4 -0
- flwr/common/exit/exit.py +8 -1
- flwr/common/exit/exit_code.py +42 -8
- flwr/common/exit/exit_handler.py +62 -0
- flwr/common/{exit_handlers.py → exit/signal_handler.py} +20 -37
- flwr/common/grpc.py +1 -1
- flwr/common/{inflatable_grpc_utils.py → inflatable_protobuf_utils.py} +52 -10
- flwr/common/inflatable_utils.py +191 -24
- flwr/common/logger.py +1 -1
- flwr/common/record/array.py +101 -22
- flwr/common/record/arraychunk.py +59 -0
- flwr/common/retry_invoker.py +30 -11
- flwr/common/serde.py +0 -28
- flwr/common/telemetry.py +4 -0
- flwr/compat/client/app.py +14 -31
- flwr/compat/server/app.py +2 -2
- flwr/proto/appio_pb2.py +51 -0
- flwr/proto/appio_pb2.pyi +195 -0
- flwr/proto/appio_pb2_grpc.py +4 -0
- flwr/proto/appio_pb2_grpc.pyi +4 -0
- flwr/proto/clientappio_pb2.py +4 -19
- flwr/proto/clientappio_pb2.pyi +0 -125
- flwr/proto/clientappio_pb2_grpc.py +269 -29
- flwr/proto/clientappio_pb2_grpc.pyi +114 -21
- flwr/proto/control_pb2.py +62 -0
- flwr/proto/{exec_pb2_grpc.py → control_pb2_grpc.py} +54 -54
- flwr/proto/{exec_pb2_grpc.pyi → control_pb2_grpc.pyi} +28 -28
- 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 +107 -38
- flwr/proto/serverappio_pb2_grpc.pyi +47 -20
- flwr/proto/simulationio_pb2.py +4 -11
- flwr/proto/simulationio_pb2.pyi +0 -58
- flwr/proto/simulationio_pb2_grpc.py +129 -27
- flwr/proto/simulationio_pb2_grpc.pyi +52 -13
- flwr/server/app.py +130 -153
- flwr/server/fleet_event_log_interceptor.py +4 -0
- flwr/server/grid/grpc_grid.py +94 -54
- flwr/server/grid/inmemory_grid.py +1 -0
- flwr/server/serverapp/app.py +165 -144
- 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/fleet/vce/backend/raybackend.py +3 -1
- flwr/server/superlink/fleet/vce/vce_api.py +6 -6
- flwr/server/superlink/linkstate/in_memory_linkstate.py +34 -0
- flwr/server/superlink/linkstate/linkstate.py +2 -1
- flwr/server/superlink/linkstate/sqlite_linkstate.py +45 -0
- flwr/server/superlink/serverappio/serverappio_grpc.py +2 -2
- flwr/server/superlink/serverappio/serverappio_servicer.py +95 -48
- flwr/server/superlink/simulation/simulationio_grpc.py +1 -1
- flwr/server/superlink/simulation/simulationio_servicer.py +98 -22
- flwr/server/superlink/utils.py +0 -35
- flwr/serverapp/__init__.py +12 -0
- flwr/serverapp/dp_fixed_clipping.py +352 -0
- flwr/serverapp/exception.py +38 -0
- flwr/serverapp/strategy/__init__.py +38 -0
- flwr/serverapp/strategy/dp_fixed_clipping.py +352 -0
- flwr/serverapp/strategy/fedadagrad.py +162 -0
- flwr/serverapp/strategy/fedadam.py +181 -0
- flwr/serverapp/strategy/fedavg.py +295 -0
- flwr/serverapp/strategy/fedopt.py +218 -0
- flwr/serverapp/strategy/fedyogi.py +173 -0
- flwr/serverapp/strategy/result.py +105 -0
- flwr/serverapp/strategy/strategy.py +285 -0
- flwr/serverapp/strategy/strategy_utils.py +251 -0
- flwr/serverapp/strategy/strategy_utils_tests.py +304 -0
- flwr/simulation/app.py +159 -154
- flwr/simulation/run_simulation.py +17 -0
- flwr/supercore/app_utils.py +58 -0
- flwr/supercore/cli/__init__.py +22 -0
- flwr/supercore/cli/flower_superexec.py +141 -0
- flwr/supercore/corestate/__init__.py +22 -0
- flwr/supercore/corestate/corestate.py +81 -0
- flwr/{server/superlink → supercore}/ffs/disk_ffs.py +1 -1
- flwr/supercore/grpc_health/__init__.py +25 -0
- flwr/supercore/grpc_health/health_server.py +53 -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/{superexec → supercore/superexec}/__init__.py +1 -1
- flwr/supercore/superexec/plugin/__init__.py +28 -0
- flwr/supercore/superexec/plugin/base_exec_plugin.py +53 -0
- flwr/supercore/superexec/plugin/clientapp_exec_plugin.py +28 -0
- flwr/supercore/superexec/plugin/exec_plugin.py +71 -0
- flwr/supercore/superexec/plugin/serverapp_exec_plugin.py +28 -0
- flwr/supercore/superexec/plugin/simulation_exec_plugin.py +28 -0
- flwr/supercore/superexec/run_superexec.py +185 -0
- flwr/supercore/utils.py +32 -0
- flwr/superlink/servicer/__init__.py +15 -0
- flwr/superlink/servicer/control/__init__.py +22 -0
- flwr/{superexec/exec_event_log_interceptor.py → superlink/servicer/control/control_event_log_interceptor.py} +9 -5
- flwr/{superexec/exec_grpc.py → superlink/servicer/control/control_grpc.py} +39 -28
- flwr/superlink/servicer/control/control_license_interceptor.py +82 -0
- flwr/{superexec/exec_servicer.py → superlink/servicer/control/control_servicer.py} +79 -31
- flwr/{superexec/exec_user_auth_interceptor.py → superlink/servicer/control/control_user_auth_interceptor.py} +18 -10
- flwr/supernode/cli/flower_supernode.py +3 -7
- flwr/supernode/cli/flwr_clientapp.py +20 -16
- flwr/supernode/nodestate/in_memory_nodestate.py +13 -4
- flwr/supernode/nodestate/nodestate.py +3 -44
- flwr/supernode/runtime/run_clientapp.py +129 -115
- flwr/supernode/servicer/clientappio/__init__.py +1 -3
- flwr/supernode/servicer/clientappio/clientappio_servicer.py +217 -165
- flwr/supernode/start_client_internal.py +205 -148
- {flwr-1.19.0.dist-info → flwr-1.21.0.dist-info}/METADATA +5 -3
- {flwr-1.19.0.dist-info → flwr-1.21.0.dist-info}/RECORD +161 -117
- {flwr-1.19.0.dist-info → flwr-1.21.0.dist-info}/entry_points.txt +1 -0
- flwr/common/inflatable_rest_utils.py +0 -99
- flwr/proto/exec_pb2.py +0 -62
- flwr/superexec/app.py +0 -45
- flwr/superexec/deployment.py +0 -192
- flwr/superexec/executor.py +0 -100
- flwr/superexec/simulation.py +0 -130
- /flwr/proto/{exec_pb2.pyi → control_pb2.pyi} +0 -0
- /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.21.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""$project_name: A Flower / $framework_str app."""
|
|
2
|
+
|
|
3
|
+
import torch
|
|
4
|
+
import torch.nn as nn
|
|
5
|
+
import torch.nn.functional as F
|
|
6
|
+
from flwr_datasets import FederatedDataset
|
|
7
|
+
from flwr_datasets.partitioner import IidPartitioner
|
|
8
|
+
from torch.utils.data import DataLoader
|
|
9
|
+
from torchvision.transforms import Compose, Normalize, ToTensor
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Net(nn.Module):
|
|
13
|
+
"""Model (simple CNN adapted from 'PyTorch: A 60 Minute Blitz')"""
|
|
14
|
+
|
|
15
|
+
def __init__(self):
|
|
16
|
+
super(Net, self).__init__()
|
|
17
|
+
self.conv1 = nn.Conv2d(3, 6, 5)
|
|
18
|
+
self.pool = nn.MaxPool2d(2, 2)
|
|
19
|
+
self.conv2 = nn.Conv2d(6, 16, 5)
|
|
20
|
+
self.fc1 = nn.Linear(16 * 5 * 5, 120)
|
|
21
|
+
self.fc2 = nn.Linear(120, 84)
|
|
22
|
+
self.fc3 = nn.Linear(84, 10)
|
|
23
|
+
|
|
24
|
+
def forward(self, x):
|
|
25
|
+
x = self.pool(F.relu(self.conv1(x)))
|
|
26
|
+
x = self.pool(F.relu(self.conv2(x)))
|
|
27
|
+
x = x.view(-1, 16 * 5 * 5)
|
|
28
|
+
x = F.relu(self.fc1(x))
|
|
29
|
+
x = F.relu(self.fc2(x))
|
|
30
|
+
return self.fc3(x)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
fds = None # Cache FederatedDataset
|
|
34
|
+
|
|
35
|
+
pytorch_transforms = Compose([ToTensor(), Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def apply_transforms(batch):
|
|
39
|
+
"""Apply transforms to the partition from FederatedDataset."""
|
|
40
|
+
batch["img"] = [pytorch_transforms(img) for img in batch["img"]]
|
|
41
|
+
return batch
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def load_data(partition_id: int, num_partitions: int):
|
|
45
|
+
"""Load partition CIFAR10 data."""
|
|
46
|
+
# Only initialize `FederatedDataset` once
|
|
47
|
+
global fds
|
|
48
|
+
if fds is None:
|
|
49
|
+
partitioner = IidPartitioner(num_partitions=num_partitions)
|
|
50
|
+
fds = FederatedDataset(
|
|
51
|
+
dataset="uoft-cs/cifar10",
|
|
52
|
+
partitioners={"train": partitioner},
|
|
53
|
+
)
|
|
54
|
+
partition = fds.load_partition(partition_id)
|
|
55
|
+
# Divide data on each node: 80% train, 20% test
|
|
56
|
+
partition_train_test = partition.train_test_split(test_size=0.2, seed=42)
|
|
57
|
+
# Construct dataloaders
|
|
58
|
+
partition_train_test = partition_train_test.with_transform(apply_transforms)
|
|
59
|
+
trainloader = DataLoader(partition_train_test["train"], batch_size=32, shuffle=True)
|
|
60
|
+
testloader = DataLoader(partition_train_test["test"], batch_size=32)
|
|
61
|
+
return trainloader, testloader
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def train(net, trainloader, epochs, lr, device):
|
|
65
|
+
"""Train the model on the training set."""
|
|
66
|
+
net.to(device) # move model to GPU if available
|
|
67
|
+
criterion = torch.nn.CrossEntropyLoss().to(device)
|
|
68
|
+
optimizer = torch.optim.Adam(net.parameters(), lr=lr)
|
|
69
|
+
net.train()
|
|
70
|
+
running_loss = 0.0
|
|
71
|
+
for _ in range(epochs):
|
|
72
|
+
for batch in trainloader:
|
|
73
|
+
images = batch["img"].to(device)
|
|
74
|
+
labels = batch["label"].to(device)
|
|
75
|
+
optimizer.zero_grad()
|
|
76
|
+
loss = criterion(net(images), labels)
|
|
77
|
+
loss.backward()
|
|
78
|
+
optimizer.step()
|
|
79
|
+
running_loss += loss.item()
|
|
80
|
+
avg_trainloss = running_loss / len(trainloader)
|
|
81
|
+
return avg_trainloss
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test(net, testloader, device):
|
|
85
|
+
"""Validate the model on the test set."""
|
|
86
|
+
net.to(device)
|
|
87
|
+
criterion = torch.nn.CrossEntropyLoss()
|
|
88
|
+
correct, loss = 0, 0.0
|
|
89
|
+
with torch.no_grad():
|
|
90
|
+
for batch in testloader:
|
|
91
|
+
images = batch["img"].to(device)
|
|
92
|
+
labels = batch["label"].to(device)
|
|
93
|
+
outputs = net(images)
|
|
94
|
+
loss += criterion(outputs, labels).item()
|
|
95
|
+
correct += (torch.max(outputs.data, 1)[1] == labels).sum().item()
|
|
96
|
+
accuracy = correct / len(testloader.dataset)
|
|
97
|
+
loss = loss / len(testloader)
|
|
98
|
+
return loss, accuracy
|
|
@@ -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.21.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.21.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.21.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.21.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.21.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.21.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.21.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
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
|
|
6
|
+
[build-system]
|
|
7
|
+
requires = ["hatchling"]
|
|
8
|
+
build-backend = "hatchling.build"
|
|
9
|
+
|
|
10
|
+
[project]
|
|
11
|
+
name = "$package_name"
|
|
12
|
+
version = "1.0.0"
|
|
13
|
+
description = ""
|
|
14
|
+
license = "Apache-2.0"
|
|
15
|
+
# Dependencies for your Flower App
|
|
16
|
+
dependencies = [
|
|
17
|
+
"flwr[simulation]>=1.21.0",
|
|
18
|
+
"flwr-datasets[vision]>=0.5.0",
|
|
19
|
+
"torch==2.7.1",
|
|
20
|
+
"torchvision==0.22.1",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[tool.hatch.build.targets.wheel]
|
|
24
|
+
packages = ["."]
|
|
25
|
+
|
|
26
|
+
[tool.flwr.app]
|
|
27
|
+
publisher = "$username"
|
|
28
|
+
|
|
29
|
+
# Point to your ServerApp and ClientApp objects
|
|
30
|
+
[tool.flwr.app.components]
|
|
31
|
+
serverapp = "$import_name.server_app:app"
|
|
32
|
+
clientapp = "$import_name.client_app:app"
|
|
33
|
+
|
|
34
|
+
# Custom config values accessible via `context.run_config`
|
|
35
|
+
[tool.flwr.app.config]
|
|
36
|
+
num-server-rounds = 3
|
|
37
|
+
fraction-train = 0.5
|
|
38
|
+
local-epochs = 1
|
|
39
|
+
lr = 0.01
|
|
40
|
+
|
|
41
|
+
# Default federation to use when running the app
|
|
42
|
+
[tool.flwr.federations]
|
|
43
|
+
default = "local-simulation"
|
|
44
|
+
|
|
45
|
+
# Local simulation federation with 10 virtual SuperNodes
|
|
46
|
+
[tool.flwr.federations.local-simulation]
|
|
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.21.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.21.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
|