quinkgl 0.1.2__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.
Files changed (51) hide show
  1. quinkgl-0.1.2/MANIFEST.in +6 -0
  2. quinkgl-0.1.2/PKG-INFO +185 -0
  3. quinkgl-0.1.2/README.md +149 -0
  4. quinkgl-0.1.2/pyproject.toml +80 -0
  5. quinkgl-0.1.2/requirements.txt +42 -0
  6. quinkgl-0.1.2/setup.cfg +4 -0
  7. quinkgl-0.1.2/src/quinkgl/__init__.py +122 -0
  8. quinkgl-0.1.2/src/quinkgl/aggregation/__init__.py +27 -0
  9. quinkgl-0.1.2/src/quinkgl/aggregation/base.py +130 -0
  10. quinkgl-0.1.2/src/quinkgl/aggregation/fedavg.py +196 -0
  11. quinkgl-0.1.2/src/quinkgl/config.py +94 -0
  12. quinkgl-0.1.2/src/quinkgl/core/__init__.py +19 -0
  13. quinkgl-0.1.2/src/quinkgl/core/context.py +93 -0
  14. quinkgl-0.1.2/src/quinkgl/core/dummy_model.py +22 -0
  15. quinkgl-0.1.2/src/quinkgl/core/model_interface.py +57 -0
  16. quinkgl-0.1.2/src/quinkgl/core/node.py +238 -0
  17. quinkgl-0.1.2/src/quinkgl/data/__init__.py +38 -0
  18. quinkgl-0.1.2/src/quinkgl/data/datasets.py +835 -0
  19. quinkgl-0.1.2/src/quinkgl/gossip/__init__.py +22 -0
  20. quinkgl-0.1.2/src/quinkgl/gossip/orchestrator.py +393 -0
  21. quinkgl-0.1.2/src/quinkgl/gossip/protocol.py +237 -0
  22. quinkgl-0.1.2/src/quinkgl/models/__init__.py +41 -0
  23. quinkgl-0.1.2/src/quinkgl/models/base.py +142 -0
  24. quinkgl-0.1.2/src/quinkgl/models/pytorch.py +311 -0
  25. quinkgl-0.1.2/src/quinkgl/models/tensorflow.py +176 -0
  26. quinkgl-0.1.2/src/quinkgl/network/__init__.py +21 -0
  27. quinkgl-0.1.2/src/quinkgl/network/connection_manager.py +434 -0
  28. quinkgl-0.1.2/src/quinkgl/network/gossip_community.py +808 -0
  29. quinkgl-0.1.2/src/quinkgl/network/gossip_node.py +307 -0
  30. quinkgl-0.1.2/src/quinkgl/network/gossip_pb2.py +44 -0
  31. quinkgl-0.1.2/src/quinkgl/network/gossip_pb2_grpc.py +145 -0
  32. quinkgl-0.1.2/src/quinkgl/network/grpc_node.py +293 -0
  33. quinkgl-0.1.2/src/quinkgl/network/ipv8_community.py +240 -0
  34. quinkgl-0.1.2/src/quinkgl/network/ipv8_manager.py +231 -0
  35. quinkgl-0.1.2/src/quinkgl/network/model_serializer.py +289 -0
  36. quinkgl-0.1.2/src/quinkgl/network/tunnel_client.py +229 -0
  37. quinkgl-0.1.2/src/quinkgl/network/tunnel_pb2.py +56 -0
  38. quinkgl-0.1.2/src/quinkgl/network/tunnel_pb2_grpc.py +101 -0
  39. quinkgl-0.1.2/src/quinkgl/storage/__init__.py +12 -0
  40. quinkgl-0.1.2/src/quinkgl/storage/model_store.py +384 -0
  41. quinkgl-0.1.2/src/quinkgl/topology/__init__.py +32 -0
  42. quinkgl-0.1.2/src/quinkgl/topology/base.py +121 -0
  43. quinkgl-0.1.2/src/quinkgl/topology/cyclon.py +94 -0
  44. quinkgl-0.1.2/src/quinkgl/topology/random.py +102 -0
  45. quinkgl-0.1.2/src/quinkgl/topology/sampler.py +105 -0
  46. quinkgl-0.1.2/src/quinkgl/utils/serialization.py +21 -0
  47. quinkgl-0.1.2/src/quinkgl.egg-info/PKG-INFO +185 -0
  48. quinkgl-0.1.2/src/quinkgl.egg-info/SOURCES.txt +49 -0
  49. quinkgl-0.1.2/src/quinkgl.egg-info/dependency_links.txt +1 -0
  50. quinkgl-0.1.2/src/quinkgl.egg-info/requires.txt +23 -0
  51. quinkgl-0.1.2/src/quinkgl.egg-info/top_level.txt +1 -0
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ include requirements.txt
4
+ recursive-include quinkgl *.py
5
+ global-exclude __pycache__
6
+ global-exclude *.py[co]
quinkgl-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: quinkgl
3
+ Version: 0.1.2
4
+ Summary: A decentralized gossip learning framework for P2P edge intelligence
5
+ Author-email: Ali Seyhan <aliseyhan@posta.mu.edu.tr>, Baki Turhan <bakiturhan@posta.mu.edu.tr>
6
+ Project-URL: Homepage, https://github.com/aliseyhann/QuinkGL-Gossip-Learning-Framework
7
+ Project-URL: Bug Tracker, https://github.com/aliseyhann/QuinkGL-Gossip-Learning-Framework/issues
8
+ Keywords: gossip-learning,federated-learning,p2p,decentralized-ai,ipv8
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Classifier: Topic :: System :: Distributed Computing
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: numpy>=1.24.0
17
+ Requires-Dist: torch>=2.0.0
18
+ Requires-Dist: torchvision>=0.15.0
19
+ Requires-Dist: scikit-learn>=1.0.0
20
+ Requires-Dist: pandas>=1.5.0
21
+ Requires-Dist: pyipv8>=2.10.0
22
+ Requires-Dist: grpcio>=1.50.0
23
+ Requires-Dist: grpcio-tools>=1.50.0
24
+ Requires-Dist: protobuf>=4.20.0
25
+ Requires-Dist: msgpack>=1.0.0
26
+ Provides-Extra: tensorflow
27
+ Requires-Dist: tensorflow>=2.12.0; extra == "tensorflow"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
30
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
31
+ Requires-Dist: black>=23.0.0; extra == "dev"
32
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
33
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
34
+ Provides-Extra: all
35
+ Requires-Dist: quinkgl[tensorflow]; extra == "all"
36
+
37
+ # QuinkGL: Gossip Learning Framework
38
+
39
+ [![PyPI version](https://badge.fury.io/py/quinkgl.svg)](https://badge.fury.io/py/quinkgl)
40
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
41
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
42
+
43
+ QuinkGL is a **decentralized, peer-to-peer (P2P) machine learning framework** designed to enable edge intelligence through Gossip Learning algorithms. Unlike traditional Federated Learning, which relies on a central server for aggregation, QuinkGL distributes the training and aggregation process across all participating nodes.
44
+
45
+ ## Key Features
46
+
47
+ - **Decentralized Architecture** – No central parameter server required
48
+ - **Gossip Learning** – Random walk and gossip-based aggregation for model convergence
49
+ - **IPv8 Networking** – Native P2P communication with NAT traversal (UDP hole punching)
50
+ - **Scalability** – Handles dynamic networks with node churn
51
+ - **Framework-Agnostic** – Supports PyTorch and TensorFlow models
52
+ - **Built-in Data Splitting** – IID and Non-IID data distribution utilities
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install quinkgl
58
+ ```
59
+
60
+ For development:
61
+
62
+ ```bash
63
+ git clone https://github.com/aliseyhann/QuinkGL-Gossip-Learning-Framework.git
64
+ cd QuinkGL-Gossip-Learning-Framework
65
+ pip install -e .
66
+ ```
67
+
68
+ ## Quick Start
69
+
70
+ ```python
71
+ import asyncio
72
+ import torch.nn as nn
73
+ from quinkgl import (
74
+ GossipNode,
75
+ PyTorchModel,
76
+ RandomTopology,
77
+ FedAvg,
78
+ TrainingConfig,
79
+ DatasetLoader,
80
+ FederatedDataSplitter
81
+ )
82
+
83
+ # 1. Define your model
84
+ class SimpleNet(nn.Module):
85
+ def __init__(self):
86
+ super().__init__()
87
+ self.fc1 = nn.Linear(784, 128)
88
+ self.fc2 = nn.Linear(128, 10)
89
+ self.relu = nn.ReLU()
90
+
91
+ def forward(self, x):
92
+ x = x.view(x.size(0), -1)
93
+ return self.fc2(self.relu(self.fc1(x)))
94
+
95
+ # 2. Wrap the model
96
+ model = PyTorchModel(SimpleNet(), device="cpu")
97
+
98
+ # 3. Create the gossip node
99
+ node = GossipNode(
100
+ node_id="alice",
101
+ domain="mnist-vision",
102
+ model=model,
103
+ topology=RandomTopology(),
104
+ aggregation=FedAvg(weight_by="data_size"),
105
+ training_config=TrainingConfig(epochs=1, batch_size=32)
106
+ )
107
+
108
+ # 4. Load and split data
109
+ loader = DatasetLoader()
110
+ (X, y), info = loader.load_iris()
111
+
112
+ splitter = FederatedDataSplitter(seed=42)
113
+ splits = splitter.create_iid_split(X, y, num_nodes=5)
114
+ my_data = splits[0] # This node's data partition
115
+
116
+ # 5. Run gossip learning
117
+ async def main():
118
+ await node.start()
119
+ await node.run_continuous(data=my_data)
120
+
121
+ asyncio.run(main())
122
+ ```
123
+
124
+ ## Public API
125
+
126
+ ### Core
127
+
128
+ | Class | Description |
129
+ |-------|-------------|
130
+ | `GossipNode` | Main P2P gossip learning node with IPv8 networking |
131
+
132
+ ### Models
133
+
134
+ | Class | Description |
135
+ |-------|-------------|
136
+ | `PyTorchModel` | Wrapper for PyTorch `nn.Module` |
137
+ | `TensorFlowModel` | Wrapper for TensorFlow/Keras models |
138
+ | `TrainingConfig` | Training configuration (epochs, batch_size, lr) |
139
+ | `TrainingResult` | Training result with metrics |
140
+
141
+ ### Topology
142
+
143
+ | Class | Description |
144
+ |-------|-------------|
145
+ | `RandomTopology` | Random peer selection strategy |
146
+ | `CyclonTopology` | Scalable peer sampling (Cyclon algorithm) |
147
+ | `PeerInfo` | Peer information dataclass |
148
+
149
+ ### Aggregation
150
+
151
+ | Class | Description |
152
+ |-------|-------------|
153
+ | `FedAvg` | Federated Averaging aggregation |
154
+ | `ModelAggregator` | Manages train→gossip→aggregate cycle |
155
+ | `ModelUpdate` | Peer model update dataclass |
156
+
157
+ ### Data
158
+
159
+ | Class | Description |
160
+ |-------|-------------|
161
+ | `DatasetLoader` | Load common datasets (CIFAR-10, Iris, etc.) |
162
+ | `FederatedDataSplitter` | Create IID/Non-IID data splits |
163
+
164
+ ## Architecture
165
+
166
+ ```
167
+ ┌─────────────────────────────────────────────────────────────┐
168
+ │ GossipNode │
169
+ ├─────────────────────────────────────────────────────────────┤
170
+ │ ┌─────────────┐ ┌──────────────┐ ┌───────────────────┐ │
171
+ │ │ PyTorchModel│ │RandomTopology│ │ FedAvg │ │
172
+ │ │ (or TF) │ │ (or Cyclon) │ │ (Aggregation) │ │
173
+ │ └─────────────┘ └──────────────┘ └───────────────────┘ │
174
+ ├─────────────────────────────────────────────────────────────┤
175
+ │ ModelAggregator │
176
+ │ (Train → Gossip → Aggregate) │
177
+ ├─────────────────────────────────────────────────────────────┤
178
+ │ IPv8 Network Layer │
179
+ │ (P2P, NAT Traversal, UDP) │
180
+ └─────────────────────────────────────────────────────────────┘
181
+ ```
182
+
183
+ ## License
184
+
185
+ MIT License © 2025, 28 December - Ali Seyhan, Baki Turhan
@@ -0,0 +1,149 @@
1
+ # QuinkGL: Gossip Learning Framework
2
+
3
+ [![PyPI version](https://badge.fury.io/py/quinkgl.svg)](https://badge.fury.io/py/quinkgl)
4
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ QuinkGL is a **decentralized, peer-to-peer (P2P) machine learning framework** designed to enable edge intelligence through Gossip Learning algorithms. Unlike traditional Federated Learning, which relies on a central server for aggregation, QuinkGL distributes the training and aggregation process across all participating nodes.
8
+
9
+ ## Key Features
10
+
11
+ - **Decentralized Architecture** – No central parameter server required
12
+ - **Gossip Learning** – Random walk and gossip-based aggregation for model convergence
13
+ - **IPv8 Networking** – Native P2P communication with NAT traversal (UDP hole punching)
14
+ - **Scalability** – Handles dynamic networks with node churn
15
+ - **Framework-Agnostic** – Supports PyTorch and TensorFlow models
16
+ - **Built-in Data Splitting** – IID and Non-IID data distribution utilities
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install quinkgl
22
+ ```
23
+
24
+ For development:
25
+
26
+ ```bash
27
+ git clone https://github.com/aliseyhann/QuinkGL-Gossip-Learning-Framework.git
28
+ cd QuinkGL-Gossip-Learning-Framework
29
+ pip install -e .
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```python
35
+ import asyncio
36
+ import torch.nn as nn
37
+ from quinkgl import (
38
+ GossipNode,
39
+ PyTorchModel,
40
+ RandomTopology,
41
+ FedAvg,
42
+ TrainingConfig,
43
+ DatasetLoader,
44
+ FederatedDataSplitter
45
+ )
46
+
47
+ # 1. Define your model
48
+ class SimpleNet(nn.Module):
49
+ def __init__(self):
50
+ super().__init__()
51
+ self.fc1 = nn.Linear(784, 128)
52
+ self.fc2 = nn.Linear(128, 10)
53
+ self.relu = nn.ReLU()
54
+
55
+ def forward(self, x):
56
+ x = x.view(x.size(0), -1)
57
+ return self.fc2(self.relu(self.fc1(x)))
58
+
59
+ # 2. Wrap the model
60
+ model = PyTorchModel(SimpleNet(), device="cpu")
61
+
62
+ # 3. Create the gossip node
63
+ node = GossipNode(
64
+ node_id="alice",
65
+ domain="mnist-vision",
66
+ model=model,
67
+ topology=RandomTopology(),
68
+ aggregation=FedAvg(weight_by="data_size"),
69
+ training_config=TrainingConfig(epochs=1, batch_size=32)
70
+ )
71
+
72
+ # 4. Load and split data
73
+ loader = DatasetLoader()
74
+ (X, y), info = loader.load_iris()
75
+
76
+ splitter = FederatedDataSplitter(seed=42)
77
+ splits = splitter.create_iid_split(X, y, num_nodes=5)
78
+ my_data = splits[0] # This node's data partition
79
+
80
+ # 5. Run gossip learning
81
+ async def main():
82
+ await node.start()
83
+ await node.run_continuous(data=my_data)
84
+
85
+ asyncio.run(main())
86
+ ```
87
+
88
+ ## Public API
89
+
90
+ ### Core
91
+
92
+ | Class | Description |
93
+ |-------|-------------|
94
+ | `GossipNode` | Main P2P gossip learning node with IPv8 networking |
95
+
96
+ ### Models
97
+
98
+ | Class | Description |
99
+ |-------|-------------|
100
+ | `PyTorchModel` | Wrapper for PyTorch `nn.Module` |
101
+ | `TensorFlowModel` | Wrapper for TensorFlow/Keras models |
102
+ | `TrainingConfig` | Training configuration (epochs, batch_size, lr) |
103
+ | `TrainingResult` | Training result with metrics |
104
+
105
+ ### Topology
106
+
107
+ | Class | Description |
108
+ |-------|-------------|
109
+ | `RandomTopology` | Random peer selection strategy |
110
+ | `CyclonTopology` | Scalable peer sampling (Cyclon algorithm) |
111
+ | `PeerInfo` | Peer information dataclass |
112
+
113
+ ### Aggregation
114
+
115
+ | Class | Description |
116
+ |-------|-------------|
117
+ | `FedAvg` | Federated Averaging aggregation |
118
+ | `ModelAggregator` | Manages train→gossip→aggregate cycle |
119
+ | `ModelUpdate` | Peer model update dataclass |
120
+
121
+ ### Data
122
+
123
+ | Class | Description |
124
+ |-------|-------------|
125
+ | `DatasetLoader` | Load common datasets (CIFAR-10, Iris, etc.) |
126
+ | `FederatedDataSplitter` | Create IID/Non-IID data splits |
127
+
128
+ ## Architecture
129
+
130
+ ```
131
+ ┌─────────────────────────────────────────────────────────────┐
132
+ │ GossipNode │
133
+ ├─────────────────────────────────────────────────────────────┤
134
+ │ ┌─────────────┐ ┌──────────────┐ ┌───────────────────┐ │
135
+ │ │ PyTorchModel│ │RandomTopology│ │ FedAvg │ │
136
+ │ │ (or TF) │ │ (or Cyclon) │ │ (Aggregation) │ │
137
+ │ └─────────────┘ └──────────────┘ └───────────────────┘ │
138
+ ├─────────────────────────────────────────────────────────────┤
139
+ │ ModelAggregator │
140
+ │ (Train → Gossip → Aggregate) │
141
+ ├─────────────────────────────────────────────────────────────┤
142
+ │ IPv8 Network Layer │
143
+ │ (P2P, NAT Traversal, UDP) │
144
+ └─────────────────────────────────────────────────────────────┘
145
+ ```
146
+
147
+ ## License
148
+
149
+ MIT License © 2025, 28 December - Ali Seyhan, Baki Turhan
@@ -0,0 +1,80 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "quinkgl"
7
+ version = "0.1.2"
8
+ description = "A decentralized gossip learning framework for P2P edge intelligence"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Ali Seyhan", email = "aliseyhan@posta.mu.edu.tr" },
12
+ { name = "Baki Turhan", email = "bakiturhan@posta.mu.edu.tr" }
13
+ ]
14
+ license = { file = "LICENSE" }
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
20
+ "Topic :: System :: Distributed Computing",
21
+ ]
22
+ keywords = ["gossip-learning", "federated-learning", "p2p", "decentralized-ai", "ipv8"]
23
+ requires-python = ">=3.9"
24
+ dependencies = [
25
+ # Core numerical computing
26
+ "numpy>=1.24.0",
27
+ # Deep learning
28
+ "torch>=2.0.0",
29
+ "torchvision>=0.15.0",
30
+ # Data handling
31
+ "scikit-learn>=1.0.0",
32
+ "pandas>=1.5.0",
33
+ # P2P networking
34
+ "pyipv8>=2.10.0",
35
+ # gRPC for communication
36
+ "grpcio>=1.50.0",
37
+ "grpcio-tools>=1.50.0",
38
+ "protobuf>=4.20.0",
39
+ # Safe serialization
40
+ "msgpack>=1.0.0",
41
+ ]
42
+
43
+ [project.optional-dependencies]
44
+
45
+ tensorflow = [
46
+ "tensorflow>=2.12.0",
47
+ ]
48
+ dev = [
49
+ "pytest>=7.0.0",
50
+ "pytest-asyncio>=0.21.0",
51
+ "black>=23.0.0",
52
+ "flake8>=6.0.0",
53
+ "mypy>=1.0.0",
54
+ ]
55
+ all = [
56
+ "quinkgl[tensorflow]",
57
+ ]
58
+
59
+ [project.urls]
60
+ "Homepage" = "https://github.com/aliseyhann/QuinkGL-Gossip-Learning-Framework"
61
+ "Bug Tracker" = "https://github.com/aliseyhann/QuinkGL-Gossip-Learning-Framework/issues"
62
+
63
+ [tool.setuptools.packages.find]
64
+ where = ["src"]
65
+ include = ["quinkgl*"]
66
+ exclude = ["tests*", "scripts*", "docker*"]
67
+
68
+ [tool.pyrefly]
69
+ exclude = [
70
+ "archives",
71
+ "docker",
72
+ "docs",
73
+ "scripts",
74
+ "examples",
75
+
76
+ ".git",
77
+ "__pycache__",
78
+ "build",
79
+ "dist"
80
+ ]
@@ -0,0 +1,42 @@
1
+ # QuinkGL Requirements
2
+ # Python 3.9+ required
3
+ #
4
+ # This file is auto-generated from pyproject.toml dependencies.
5
+ # For development, use: pip install -e ".[dev]"
6
+ # For all extras: pip install -e ".[all]"
7
+
8
+ # Core numerical computing
9
+ numpy>=1.24.0
10
+
11
+ # Deep learning
12
+ torch>=2.0.0
13
+ torchvision>=0.15.0
14
+
15
+ # Data handling
16
+ scikit-learn>=1.0.0
17
+ pandas>=1.5.0
18
+
19
+ # P2P networking
20
+ pyipv8>=2.10.0
21
+
22
+ # gRPC for communication
23
+ grpcio>=1.50.0
24
+ grpcio-tools>=1.50.0
25
+ protobuf>=4.20.0
26
+
27
+ # Safe serialization (replaces pickle for security)
28
+ msgpack>=1.0.0
29
+
30
+
31
+
32
+ # Installation Notes:
33
+ # ==================
34
+ #
35
+ # Standard installation:
36
+ # pip install -r requirements.txt
37
+ #
38
+ # Development installation:
39
+ # pip install -e ".[dev]"
40
+ #
41
+ # With all optional features:
42
+ # pip install -e ".[all]"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,122 @@
1
+ """
2
+ QuinkGL: Decentralized Gossip Learning Framework
3
+
4
+ A Python framework for decentralized machine learning using
5
+ gossip-based peer-to-peer communication.
6
+
7
+ Example:
8
+ from quinkgl import (
9
+ GossipNode,
10
+ PyTorchModel,
11
+ RandomTopology,
12
+ FedAvg,
13
+ TrainingConfig
14
+ )
15
+
16
+ model = PyTorchModel(my_pytorch_model)
17
+ node = GossipNode(
18
+ node_id="alice",
19
+ domain="health",
20
+ model=model,
21
+ topology=RandomTopology(),
22
+ aggregation=FedAvg()
23
+ )
24
+ await node.start()
25
+ await node.run_continuous(training_data)
26
+ """
27
+
28
+ __version__ = "0.1.0"
29
+
30
+ # =============================================================================
31
+ # CORE - Main node class
32
+ # =============================================================================
33
+ from quinkgl.network.gossip_node import GossipNode
34
+
35
+ # =============================================================================
36
+ # MODELS - Framework-specific model wrappers
37
+ # =============================================================================
38
+ from quinkgl.models.base import (
39
+ ModelWrapper,
40
+ TrainingConfig,
41
+ TrainingResult
42
+ )
43
+ from quinkgl.models.pytorch import PyTorchModel
44
+
45
+ # TensorFlow is optional - only import if available
46
+ try:
47
+ from quinkgl.models.tensorflow import TensorFlowModel
48
+ _tensorflow_available = True
49
+ except ImportError:
50
+ _tensorflow_available = False
51
+ TensorFlowModel = None # type: ignore
52
+
53
+ # =============================================================================
54
+ # TOPOLOGY - Peer selection strategies
55
+ # =============================================================================
56
+ from quinkgl.topology.base import (
57
+ TopologyStrategy,
58
+ PeerInfo,
59
+ SelectionContext
60
+ )
61
+ from quinkgl.topology.random import RandomTopology
62
+ from quinkgl.topology.cyclon import CyclonTopology
63
+
64
+ # =============================================================================
65
+ # AGGREGATION - Model combining strategies
66
+ # =============================================================================
67
+ from quinkgl.aggregation.base import (
68
+ AggregationStrategy,
69
+ ModelUpdate,
70
+ AggregatedModel
71
+ )
72
+ from quinkgl.aggregation.fedavg import FedAvg
73
+
74
+ # =============================================================================
75
+ # GOSSIP - Model aggregation orchestration
76
+ # =============================================================================
77
+ from quinkgl.gossip.orchestrator import ModelAggregator
78
+
79
+ # =============================================================================
80
+ # DATA - Dataset loading and splitting
81
+ # =============================================================================
82
+ from quinkgl.data.datasets import (
83
+ DatasetLoader,
84
+ FederatedDataSplitter,
85
+ DatasetInfo
86
+ )
87
+
88
+ # =============================================================================
89
+ # PUBLIC API
90
+ # =============================================================================
91
+ __all__ = [
92
+ # Core
93
+ "GossipNode",
94
+
95
+ # Models
96
+ "ModelWrapper",
97
+ "TrainingConfig",
98
+ "TrainingResult",
99
+ "PyTorchModel",
100
+ "TensorFlowModel",
101
+
102
+ # Topology
103
+ "TopologyStrategy",
104
+ "RandomTopology",
105
+ "CyclonTopology",
106
+ "PeerInfo",
107
+ "SelectionContext",
108
+
109
+ # Aggregation
110
+ "AggregationStrategy",
111
+ "FedAvg",
112
+ "ModelUpdate",
113
+ "AggregatedModel",
114
+
115
+ # Gossip
116
+ "ModelAggregator",
117
+
118
+ # Data
119
+ "DatasetLoader",
120
+ "FederatedDataSplitter",
121
+ "DatasetInfo",
122
+ ]
@@ -0,0 +1,27 @@
1
+ """
2
+ Aggregation Strategies Module
3
+
4
+ This module provides pluggable aggregation strategies for combining
5
+ model updates from multiple peers.
6
+
7
+ Usage:
8
+ from quinkgl.aggregation import FedAvg
9
+
10
+ aggregator = FedAvg(weight_by="data_size")
11
+ aggregated = await aggregator.aggregate(updates)
12
+ """
13
+
14
+ from quinkgl.aggregation.base import (
15
+ AggregationStrategy,
16
+ ModelUpdate,
17
+ AggregatedModel
18
+ )
19
+ from quinkgl.aggregation.fedavg import FedAvg
20
+
21
+ # Export main classes
22
+ __all__ = [
23
+ "AggregationStrategy",
24
+ "ModelUpdate",
25
+ "AggregatedModel",
26
+ "FedAvg",
27
+ ]