FedModelKit 0.6.5__tar.gz → 0.6.7__tar.gz
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.
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/PKG-INFO +1 -1
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/pyproject.toml +1 -1
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/client_app_template.py +3 -3
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/extern_pyproject_template.toml +1 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/server_app_template.py +19 -19
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/uv.lock +1 -1
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/.gitignore +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/.python-version +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/LICENSE +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/README.md +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/examples/simulation-scikit-model/.gitignore +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/examples/simulation-scikit-model/AML_preprocessed_dataset.xlsx +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/examples/simulation-scikit-model/README.md +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/examples/simulation-scikit-model/simulation_example.ipynb +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/images/aggregator.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/images/federated_learning_model.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/images/local_learner.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/README.md +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/__init__.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/aggregator.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/cli.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/default_create_functions.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/interface.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/local_learner.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/py.typed +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/src/utils.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/__init__template.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/ds_template.ipynb +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/images/doSendModels.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/images/doWaitsForJobs.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/images/dsAggregateModels.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/images/dsDoneSubmittingJobs.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/images/dsSendsJobs.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/images/overview.png +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/main_template.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/pyproject_template.toml +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/readme_template.md +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/task_template.py +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/uv_template.lock +0 -0
- {fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: FedModelKit
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.7
|
|
4
4
|
Summary: LOW_LEVEL_API: This package contains the core components and protocols for creating, managing, and registering federated learning models using MLflow. It provides utilities for defining local learners, aggregation strategies, and integrating them with MLflow for tracking and deployment.
|
|
5
5
|
Author-email: ceresale <alessandro.ceresi@upm.es>
|
|
6
6
|
License-File: LICENSE
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "FedModelKit"
|
|
3
|
-
version = "0.6.
|
|
3
|
+
version = "0.6.7"
|
|
4
4
|
description = "LOW_LEVEL_API: This package contains the core components and protocols for creating, managing, and registering federated learning models using MLflow. It provides utilities for defining local learners, aggregation strategies, and integrating them with MLflow for tracking and deployment."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -35,7 +35,7 @@ def query(msg: Message, ctx: Context) -> Message:
|
|
|
35
35
|
# To store in context other objects, you can use ctx.state.<object_name> = <object>
|
|
36
36
|
ctx.state.local_learner = federated_model
|
|
37
37
|
|
|
38
|
-
return
|
|
38
|
+
return Message(RecordDict(), reply_to=msg)
|
|
39
39
|
|
|
40
40
|
@app.train()
|
|
41
41
|
def train(msg: Message, ctx: Context):
|
|
@@ -71,7 +71,7 @@ def train(msg: Message, ctx: Context):
|
|
|
71
71
|
ctx.state.local_learner = local_learner
|
|
72
72
|
|
|
73
73
|
# Return the reply message to the server
|
|
74
|
-
return
|
|
74
|
+
return Message(reply_content, reply_to=msg)
|
|
75
75
|
|
|
76
76
|
@app.evaluate()
|
|
77
77
|
def eval(msg: Message, ctx: Context):
|
|
@@ -103,4 +103,4 @@ def eval(msg: Message, ctx: Context):
|
|
|
103
103
|
ctx.state.local_learner = local_learner
|
|
104
104
|
|
|
105
105
|
# Return the reply message to the server
|
|
106
|
-
return
|
|
106
|
+
return Message(reply_content, reply_to=msg)
|
|
@@ -26,7 +26,7 @@ app = fl.server.ServerApp()
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
@app.main()
|
|
29
|
-
def main(
|
|
29
|
+
def main(grid: Grid, context: Context):
|
|
30
30
|
"""
|
|
31
31
|
Main function to run the federated learning server.
|
|
32
32
|
|
|
@@ -41,7 +41,7 @@ def main(driver: Grid, context: Context):
|
|
|
41
41
|
print("Starting test run")
|
|
42
42
|
|
|
43
43
|
# Get node IDs of connected clients
|
|
44
|
-
node_ids =
|
|
44
|
+
node_ids = grid.get_node_ids()
|
|
45
45
|
|
|
46
46
|
# Initialize the federated model
|
|
47
47
|
global_model = Net()
|
|
@@ -51,14 +51,14 @@ def main(driver: Grid, context: Context):
|
|
|
51
51
|
messages = []
|
|
52
52
|
for idx, node_id in enumerate(node_ids):
|
|
53
53
|
# Create messages to send to clients
|
|
54
|
-
|
|
54
|
+
record_dict = RecordDict()
|
|
55
55
|
|
|
56
56
|
# Add a config with information to send the client for the query
|
|
57
|
-
|
|
57
|
+
record_dict.config_records["fancy_config"] = ConfigRecord({"num_clients": len(node_ids), "client_id": idx})
|
|
58
58
|
|
|
59
59
|
# Create a query message for each client
|
|
60
|
-
message =
|
|
61
|
-
content=
|
|
60
|
+
message = Message(
|
|
61
|
+
content=record_dict,
|
|
62
62
|
message_type=MessageType.QUERY,
|
|
63
63
|
dst_node_id=node_id,
|
|
64
64
|
group_id=str(1),
|
|
@@ -67,7 +67,7 @@ def main(driver: Grid, context: Context):
|
|
|
67
67
|
messages.append(message)
|
|
68
68
|
|
|
69
69
|
# Send training messages to clients
|
|
70
|
-
all_replies = list(
|
|
70
|
+
all_replies = list(grid.send_and_receive(messages))
|
|
71
71
|
print(f"Received {len(all_replies)} answers")
|
|
72
72
|
|
|
73
73
|
|
|
@@ -78,16 +78,16 @@ def main(driver: Grid, context: Context):
|
|
|
78
78
|
messages = []
|
|
79
79
|
for idx, node_id in enumerate(node_ids):
|
|
80
80
|
# Create messages to send to clients
|
|
81
|
-
|
|
81
|
+
record_dict = RecordDict()
|
|
82
82
|
|
|
83
83
|
# Add model parameters to record
|
|
84
|
-
|
|
84
|
+
record_dict.array_records["fancy_model"] = global_model.get_parameters()
|
|
85
85
|
# Add a config with information to send the client for training
|
|
86
|
-
|
|
86
|
+
record_dict.config_records["fancy_config"] = ConfigRecord({"local_epochs": 3})
|
|
87
87
|
|
|
88
88
|
# Create a training message for each client
|
|
89
|
-
message =
|
|
90
|
-
content=
|
|
89
|
+
message = Message(
|
|
90
|
+
content=record_dict,
|
|
91
91
|
message_type=MessageType.TRAIN,
|
|
92
92
|
dst_node_id=node_id,
|
|
93
93
|
group_id=str(server_round),
|
|
@@ -96,7 +96,7 @@ def main(driver: Grid, context: Context):
|
|
|
96
96
|
messages.append(message)
|
|
97
97
|
|
|
98
98
|
# Send training messages to clients
|
|
99
|
-
all_replies = list(
|
|
99
|
+
all_replies = list(grid.send_and_receive(messages))
|
|
100
100
|
print(f"Received {len(all_replies)} results")
|
|
101
101
|
|
|
102
102
|
# Print metrics received from clients
|
|
@@ -112,16 +112,16 @@ def main(driver: Grid, context: Context):
|
|
|
112
112
|
messages = []
|
|
113
113
|
for idx, node_id in enumerate(node_ids):
|
|
114
114
|
# Create evaluation messages for clients
|
|
115
|
-
|
|
115
|
+
record_dict = RecordDict()
|
|
116
116
|
|
|
117
117
|
# Add updated model parameters to record
|
|
118
|
-
|
|
118
|
+
record_dict.array_records["fancy_model"] = new_array_records
|
|
119
119
|
# Add a config with information to send the client for evaluation
|
|
120
|
-
|
|
120
|
+
record_dict.config_records["fancy_config"] = ConfigRecord({"local_epochs": 3})
|
|
121
121
|
|
|
122
122
|
# Create an evaluation message for each client
|
|
123
|
-
message =
|
|
124
|
-
content=
|
|
123
|
+
message = Message(
|
|
124
|
+
content=record_dict,
|
|
125
125
|
message_type=MessageType.EVALUATE,
|
|
126
126
|
dst_node_id=node_id,
|
|
127
127
|
group_id=str(server_round),
|
|
@@ -130,7 +130,7 @@ def main(driver: Grid, context: Context):
|
|
|
130
130
|
messages.append(message)
|
|
131
131
|
|
|
132
132
|
# Send evaluation messages to clients
|
|
133
|
-
all_replies = list(
|
|
133
|
+
all_replies = list(grid.send_and_receive(messages))
|
|
134
134
|
print(f"Received {len(all_replies)} results")
|
|
135
135
|
|
|
136
136
|
# Print evaluation metrics received from clients
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/examples/simulation-scikit-model/simulation_example.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/images/dsAggregateModels.png
RENAMED
|
File without changes
|
{fedmodelkit-0.6.5 → fedmodelkit-0.6.7}/src/FedModelKit/templates/images/dsDoneSubmittingJobs.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|