AbstractIntegratedModule 0.2.7__cp313-cp313-win_amd64.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.
- AbstractIntegratedModule.py +13093 -0
- abstractintegratedmodule-0.2.7.data/data/AbstractIntegratedModule.cp313-win_amd64.pyd +0 -0
- abstractintegratedmodule-0.2.7.data/data/AbstractIntegratedModule.cpython-310-aarch64-linux-gnu.so +0 -0
- abstractintegratedmodule-0.2.7.data/data/AbstractIntegratedModule.cpython-312-x86_64-linux-gnu.so +0 -0
- abstractintegratedmodule-0.2.7.dist-info/METADATA +1091 -0
- abstractintegratedmodule-0.2.7.dist-info/RECORD +8 -0
- abstractintegratedmodule-0.2.7.dist-info/WHEEL +5 -0
- abstractintegratedmodule-0.2.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1091 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: AbstractIntegratedModule
|
|
3
|
+
Version: 0.2.7
|
|
4
|
+
Summary: Framework forAdvanced Integrated Non-LLM AI Module library - Backend Framework for Non-LLM AI Agent Framework
|
|
5
|
+
Author: Micro-Novelty
|
|
6
|
+
Author-email: hernikpuspita5@gmail.com
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: numpy>=1.21.0
|
|
17
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
18
|
+
Requires-Dist: pandas>=1.3.0
|
|
19
|
+
Requires-Dist: joblib>=1.1.0
|
|
20
|
+
Requires-Dist: cryptography>=41.0.0
|
|
21
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
22
|
+
Requires-Dist: psutil>=5.9.0
|
|
23
|
+
Dynamic: author
|
|
24
|
+
Dynamic: author-email
|
|
25
|
+
Dynamic: classifier
|
|
26
|
+
Dynamic: description
|
|
27
|
+
Dynamic: description-content-type
|
|
28
|
+
Dynamic: license
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
32
|
+
|
|
33
|
+
# [=] IntegratedPipeline-Specialized-AI-Agent-library
|
|
34
|
+
|
|
35
|
+
[~] IntegratedPipeline is a standalone Specialized AI Agent Library for Non-LLL memory Augmented Agentic Framework orchestrator, Specifically designed to provide Agentic capability for any Autonomous Agentic Framework locally and Coordinatively that runs efficiently from consumer based machine to High-end embedded systems, where the AI Can directly and continously learn, with minimal and efficient compute, built-in augmented memory, Secure Peer-To-Peer (Multi-Agent) Coordination with security layers as an option, And Explainability capability based on proof from in it's internal metrics, reducing Black-Box condition necessary for reliability. Containing specialized MLP using Its Own specialized geometric Weight shaping (AWE) and Specialized efficient Transformer for Scarce Data with Alpha-based computation, specifically designed for low-amount samples environment, or Messy environments.
|
|
36
|
+
|
|
37
|
+
#### Github Repo (if you want to know or contribute)
|
|
38
|
+
https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent-Framework
|
|
39
|
+
|
|
40
|
+
#### Note: The README here you are reading is a direct copy from my README Repository, to download the necessary files, you can visit my Repository with the provided link above.
|
|
41
|
+
|
|
42
|
+
### Library Short Description:
|
|
43
|
+
- Development Stage: Beta, 0.2.5.
|
|
44
|
+
- Maintainer: Micro-Novelty.
|
|
45
|
+
- library Source-Code is Open-sourced on github.
|
|
46
|
+
- Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
|
|
47
|
+
- Proven Capabilities: Works on ARM64 Environment, Training and Prediction works efficient on Docker ARM64 environment with QEMU, good parallelizing behavior is guaranteed.
|
|
48
|
+
-----
|
|
49
|
+
|
|
50
|
+
<img width="1280" height="600" alt="WhatsApp Image 2026-05-27 at 07 16 32" src="https://github.com/user-attachments/assets/4b58a556-45a3-419b-96fd-9c1b76cac574" />
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [+] MANN Intro
|
|
54
|
+
[=] Memory augmented Neural network (MANN) is a neural network architecture coupled with an external, dynamic memory module, allowing it to store, retrieve, and update information similarly to a computer's RAM. Unlike traditional networks that store knowledge only in weight parameters, MANNs excel at fast learning, long-term dependency handling, and episodic recall, In IntegratedPipeline, Its memory is stored in a custom database inside your local machine, then later used for memory retrieval, transfered to the AI Dictionary where it can finnaly recall its memory when input condition matched with memory.
|
|
55
|
+
|
|
56
|
+
## [+] Abstract Weight Encoder (AWE) Intro
|
|
57
|
+
[=] AWE is a specialized custom weight shaping or encoding method Specifically designed for MLP Architecture, using eigenvalue and spectral methods as base equations to calculate covariance inside a given input data, and shape the correct Weight from the given eigenvalue, AWE Works by processing input and then captures the necessary eigenvalue to shape a properly initialized Weight that aligns with input data complexity, With this approach, MLP training will be much more consistent and robust against noise.
|
|
58
|
+
|
|
59
|
+
[~] For a much In-Depth Explanation You can visit This repository to learn more about AWE and its performance results:
|
|
60
|
+
- Link: https://github.com/Micro-Novelty/Specialized-MLP-for-noise-robustness
|
|
61
|
+
|
|
62
|
+
## [+] Why IntegratedPipeline?
|
|
63
|
+
[~] IntegratedPipeline is a great choice for a sophisticated Non-LLM AI Program for The Main Orchestrator of a Distributed MANN-Type AI Agent Working in Edge-device/Consumer-Based machine Where LLM is'nt a great fit for Messy, Noisy environments. while still run efficiently on High-end Embedded systems in single-instance or as a distributed network during multi Agent cooperation.
|
|
64
|
+
|
|
65
|
+
[=] IntegratedPipeline offers:
|
|
66
|
+
1. Local-Based AI Orchestrator:
|
|
67
|
+
- IntegratedPipeline Creates its own SQLite Database inside Your Computer once the library is executed, This database is used directly to store the AI Memory, Attention weights, predicted Output, and identified peer, all without leaving the machine, The Database will be created Automatically once you run the library, database name saved as activity_log.db.
|
|
68
|
+
|
|
69
|
+
2. Continously Learning behavior for an Agent:
|
|
70
|
+
- different from LLM that is static and cannot improve beyond its given training condition, AI Agent using IntegratedPipeline has a dynamic, flexible continously learning behavior with conditional training algorithms included in the library that has both supervised and unsupervised learning present, The learned input and predicted Output will be stored in the database, allowing it to recall its memory during processing and find matching known prediction given if input matched with the stored input inside the database. this Continous learning behavior is efficient because its not relying on weights for memory, allowing flexible and predictable behavior inside a given environment.
|
|
71
|
+
|
|
72
|
+
3. Robust Specialized MLP and Transformer Architecture with ensemble weighting:
|
|
73
|
+
- IntegratedPipeline has 2 Different type's of AI Architecture stacked together, and one architecture to weight their confidence and probability fairly to get the final prediction, Specialized MLP for Noise robustness And Specialized Transformer that used Alpha-based Computing algorithm for contextual reasoning, The reason why those Models complement and used together :
|
|
74
|
+
- Specialized MLP Provides synchronous robust classification Against noise with its specialized Weight Encoder (AWE) to handle noise using eigenvalue based computing that is lightweight and efficient. This Method can't be replicated Inside Transformer FFN (Feed-forward-network) because of Transformer dynamic brute force computing where AWE-Based generated weight's get diluted over time by Transformer dynamic projection embedding, making AWE Generated weight causes inefficient inside Transformer dynamic FFN/QKV projection.
|
|
75
|
+
- Specialized Transformer provides robust synchronous advanced contextual relationships, efficient data processing using Alpha based computing, The Transformer is tuned towards to be as flexible as possible to provide dynamic projection or fixed FFN projection training with minimal head's and dimension's to reduce computational power.
|
|
76
|
+
- Ensemble weighting provides the model a much more robust classification best from both worlds perspective, weighting both MLP and Transformer confidence and probability, combined with Attention quality from the transformer to get the final prediction of an input if transformer is allowed and permitted to be in use.
|
|
77
|
+
|
|
78
|
+
4. flexible and secure Peer-to-Peer Coordination (Multi-Agent):
|
|
79
|
+
- IntegratedPipeline offers Peer to Peer communication capabilities asynchronously, Where IntegratedPipeline directly checks for other Peer presence directly to the local database present in the local computer or system (Synchronous prediction from peer previous data in the database), or externally, by using asynchronous request for initiating prediction, P2P is secured Using:
|
|
80
|
+
- secure socket using user provided SSL CERT. on both client and server,
|
|
81
|
+
- API key for requesting,
|
|
82
|
+
- Alpha rate limiting,
|
|
83
|
+
- HMAC secret key for authentication,
|
|
84
|
+
- and IP validation.
|
|
85
|
+
[~] Each agent has double roles during P2P:
|
|
86
|
+
- Server provider: the peer Agent can start a server to listen for peer client's
|
|
87
|
+
- Connecting Agent: the peer Agent which happens to connect to other peer that has or have opened and provided a server listener to act as a receiver.
|
|
88
|
+
|
|
89
|
+
5. Cross-Session memory availability:
|
|
90
|
+
- IntegratedPipeline offers share-able Memory capability, included capability below:
|
|
91
|
+
- Exportable memory: this allows a flexible memory saving for later use, such as cross transfer memory between model, the memory is saved as .json file after exporting.
|
|
92
|
+
- Importable Memory: allowing to import memory from the exported .json file directly for the model to use.
|
|
93
|
+
- syncing with other model: socket-based communication to export memory to other external machine.
|
|
94
|
+
- [=] Note: socket Syncing is unsecure witout additional security layer wrapped, For a safer syncing, directly transfer the .json file memory to the target machine via other ways such as manual send.
|
|
95
|
+
- list sessions: listing available sessions using model's memory name.
|
|
96
|
+
|
|
97
|
+
[=] With its Specialized Multi-Layer-Perceptron (using AWE Encoder) and Optimized Transformer module with optimized Embedding, IntegratedPipeline can directly tolerate low samples-amount of Data, including noisy ambiguous data, using Weighted Confidence assembling from both specialized MLP and Transformer for better reliability during training and prediction over Messy, noisy environments, such as:
|
|
98
|
+
|
|
99
|
+
[1.] User data's : User data is often messy and ambiguous, Specialized MLP with AWE will do the job for shaping the necessary Weight to complement for the Ambiguous noisy pattern, AWE MLP is highly robust to noise, proven in synthetic Environment such as scikit-learn Make-Classification scarce and Noisy Input robustness during generalization test. making it a great fit for messy, Scarce data.
|
|
100
|
+
|
|
101
|
+
[2.] Small Dataset's : We often don't have enough Dataset to train a Transformer Model, Thats Why IntegratedPipeline Offers a Highly optimized Transformer that supports scarce dataset processing, Using Alpha-Based computing as a Warm-up for training, it provides a direct Boost for the transformer to be efficient during training in scarce-data Environment.
|
|
102
|
+
|
|
103
|
+
[3.] Non-Representative data (Undersampled) : IntegratedPipeline Support's ambiguous data that come's from file with format such as CSV Format to extract title's and label's necessary to create automatic Dataset for Later use in Training, making it optimized for specific task's and easier dataset creation with lower overfitting rate for reliability.
|
|
104
|
+
|
|
105
|
+
[=] Architectural-Overview
|
|
106
|
+
<img width="1600" height="860" alt="WhatsApp Image 2026-05-09 at 16 13 41" src="https://github.com/user-attachments/assets/580722aa-bbd8-4148-a425-4bff01c06c47" />
|
|
107
|
+
[=] Contextual meaning:
|
|
108
|
+
1. - Sequence encoding is a machine learning technique that transforms a sequential input (like text, time-series data, or audio) into a compact, fixed-length numerical vector, often called a context vector
|
|
109
|
+
2. - TF-IDF (Term Frequency-Inverse Document Frequency) is a numerical statistic used in machine learning and NLP to evaluate how important a word is to a document within a collection (corpus). It boosts rare words and penalizes common words (like "the", "and") by multiplying two metrics: how often a word appears in a document (TF) and the inverse frequency of the word across all documents (IDF).
|
|
110
|
+
3. - Explainability provides deeper transparency of why a model thought about a detail by showing its internal metrics like attention quality, from distributed peer memory or Ensemble prediction result's.
|
|
111
|
+
|
|
112
|
+
### Introduction and demo
|
|
113
|
+
[](https://youtu.be/RmWvwDHU_QY?si=Lvl8mt8c_BnFypS_)
|
|
114
|
+
|
|
115
|
+
## [=] Requirements
|
|
116
|
+
[~] To run and execute IntegratedPipeline, Requirement's include Or see [Requirements](requirements.txt):
|
|
117
|
+
- pip install for quick usage:
|
|
118
|
+
- ```bash
|
|
119
|
+
pip install AbstractIntegratedModule # or
|
|
120
|
+
python -m pip install AbstractIntegratedModule
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
- Download binaries manually (Choose one minimal, specified for your needs):
|
|
124
|
+
- Binaries can be downloaded from release or code section.
|
|
125
|
+
- Windows Native OS - AbstractIntegratedModule.cp313-win_amd64 Supports Python 3.13 for Windows Only (Robust, Stable version)
|
|
126
|
+
- Linux x86_64 - AbstractIntegratedModule.cpython-312-x86_64-linux-gnu.so supports Python 3.12 only.
|
|
127
|
+
- Linux ARM64 - Raspberry Pi (Supports Raspberry pi 3 - 5) - AbstractIntegratedModule.cpython-310-aarch64-linux-gnu.so supports Python 3.10 only.
|
|
128
|
+
- Libraries needed (For binary usage):
|
|
129
|
+
- Pandas
|
|
130
|
+
- aiohttp
|
|
131
|
+
- scikit-learn
|
|
132
|
+
- numpy
|
|
133
|
+
- psutil
|
|
134
|
+
|
|
135
|
+
- Download AbstractIntegratedModule binaries from release section or in here, [AbstractIntegratedModule Package](AbstractIntegratedModule-Package.zip)
|
|
136
|
+
- This file contains:
|
|
137
|
+
- AbstractIntegratedModule.pyd (For windows machine).
|
|
138
|
+
- AbstractIntegratedModule.cpython-39-x86_64-linux-gnu.so (For linux x86_64).
|
|
139
|
+
- AbstractIntegratedModule.cpython-39-aarch64-linux-gnu.so (for Linux ARM64 - Raspberry Pi).
|
|
140
|
+
|
|
141
|
+
[=] for labels assignation:
|
|
142
|
+
- CSV file that contains training labels and titles used for training and prediction label map, example will be provided below, Go to Step's for in-depth Usage below.
|
|
143
|
+
|
|
144
|
+
### [=] Requirements for Docker container
|
|
145
|
+
- Dockerfile (For Container assembler)
|
|
146
|
+
- Python scripts (Such as main.py for Dockerfile usage).
|
|
147
|
+
- entrypoint.sh (for smart entry point for Dockerfile container usage).
|
|
148
|
+
|
|
149
|
+
## [=] System-Specific Notes
|
|
150
|
+
1. Windows:
|
|
151
|
+
- Requires Visual C++ Build Tools for compatibility
|
|
152
|
+
- Use PowerShell or CMD (not WSL bash for best results)
|
|
153
|
+
|
|
154
|
+
2. Linux:
|
|
155
|
+
- Ensure gcc and build-essential are installed
|
|
156
|
+
- Different distributions may require different package managers
|
|
157
|
+
|
|
158
|
+
3. ARM64 - Raspberry Pi
|
|
159
|
+
- Installation may take 30+ minutes due to ARM architecture
|
|
160
|
+
- Monitor system resources during installation
|
|
161
|
+
- Consider using faster storage (USB SSD) for better performance
|
|
162
|
+
|
|
163
|
+
## [=] Docker Container Application
|
|
164
|
+
0. See [Docker_installation_Section](Docker_installation_Section.md) for an in-depth explanation, or [Quick_Docker_start](Quick_Docker_start.sh) for a quick start.
|
|
165
|
+
- Note Consider checking:
|
|
166
|
+
- [Dockerfile](Dockerfile) contains all the instructions need to assemble a Docker container.
|
|
167
|
+
- [start.sh](start.sh) for Quick single agent start in Docker container.
|
|
168
|
+
- [entrypoint.sh](entrypoint.sh) for a Smart entrypoint used in Dockerfile (Must be downloaded too along with Dockerfile and put in the same folder with Dockerfile after its downloaded)
|
|
169
|
+
- [start-multi-agent-cluster.sh](start-multi-agent-cluster.sh) for Multi-agent cluster start in Docker container, What it does:
|
|
170
|
+
- Starts a multi-agent Docker cluster — runs docker-compose up -d in detached mode (background), scaling the agent-client service to 5 simultaneous instances, alongside whatever server is defined in the docker-compose.yml.
|
|
171
|
+
- Tails the logs — runs docker-compose logs -f which streams live logs from all containers (server + all 5 clients) to your terminal until you hit Ctrl+C.
|
|
172
|
+
- [main.py](main.py) for executing a python script in the Docker container that used main.py, like in this code:
|
|
173
|
+
- ```bash
|
|
174
|
+
docker run -it -v $(pwd):/app/data integrated-pipeline:latest python /app/data/main.py
|
|
175
|
+
```
|
|
176
|
+
- To use a [.dockerignore](.dockerignore) file, place it in your build context directory (the same location as your Dockerfile) to specify which files and folders should be excluded when building your image.
|
|
177
|
+
- [.env](.env) is used for environment setup in [entrypoint.sh](entrypoint.sh), this file must be in the same folder with Dockerfile and entrypoint.sh after its downloaded.
|
|
178
|
+
|
|
179
|
+
1. Build Image:
|
|
180
|
+
- Clone repository:
|
|
181
|
+
- ```bash
|
|
182
|
+
git clone https://github.com/Micro-Novelty/IntegratedPipeline-Continous-Learning-AI-Agent-library-framework.git
|
|
183
|
+
cd IntegratedPipeline-Continous-Learning-AI-Agent-library-framework
|
|
184
|
+
```
|
|
185
|
+
- Download:
|
|
186
|
+
- [Dockerfile](Dockerfile),
|
|
187
|
+
- [entrypoint.sh](entrypoint.sh)
|
|
188
|
+
- [.env](.env)
|
|
189
|
+
- In the code or release section.
|
|
190
|
+
|
|
191
|
+
- If the downloaded Dockerfile or .dockerignore or .env has .txt extension, remove the extension:
|
|
192
|
+
- ```bash
|
|
193
|
+
# remove .txt extension
|
|
194
|
+
mv Dockerfile.txt Dockerfile
|
|
195
|
+
mv env.txt .env
|
|
196
|
+
mv dockerignore.txt .dockerignore
|
|
197
|
+
```
|
|
198
|
+
- Navigate to the folder: Use the cd command to enter the directory containing the Dockerfile and entrypoint.sh file.
|
|
199
|
+
- ```
|
|
200
|
+
cd /path/to/your/folder
|
|
201
|
+
```
|
|
202
|
+
- build image:
|
|
203
|
+
- ```bash
|
|
204
|
+
sudo docker build -t integrated-agent.
|
|
205
|
+
```
|
|
206
|
+
2. Download library dependencies for binaries usage:
|
|
207
|
+
[=] Required libraries (when using binary):
|
|
208
|
+
- Numpy
|
|
209
|
+
- Scikit-learn
|
|
210
|
+
- pandas
|
|
211
|
+
- aiohttp
|
|
212
|
+
- psutil
|
|
213
|
+
|
|
214
|
+
4. Run IntegratedPipeline in a Container:
|
|
215
|
+
- Install AbstractIntegratedModule via PIP or binaries (for binaries, can be downloaded in release section):
|
|
216
|
+
- ```bash
|
|
217
|
+
pip install AbstractIntegratedModule # or
|
|
218
|
+
python -m pip install AbstractIntegratedModule
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
- ```bash
|
|
222
|
+
docker run -it --name ai-agent integrated-agent:latest python
|
|
223
|
+
```
|
|
224
|
+
- In python shell:
|
|
225
|
+
- ```
|
|
226
|
+
from AbstractIntegratedModule import IntegratedPipeline, PipelinePredictionManager
|
|
227
|
+
model = IntegratedPipeline('agent_memory')
|
|
228
|
+
print("✓ IntegratedPipeline initialized successfully!")
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
5. Run script:
|
|
232
|
+
```bash
|
|
233
|
+
# Mount your local directory and run a script
|
|
234
|
+
docker run -it -v $(pwd)/data:/app/data integrated-agent:latest python main.py # main.py could be replaced
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
6. Run with GPU Support (Optional):
|
|
238
|
+
- ```bash
|
|
239
|
+
# For NVIDIA GPU support
|
|
240
|
+
docker run -it --gpus all -v $(pwd)/data:/app/data integrated-agent:latest python main.py
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
7. For Single Agent and Multi-Agent P2P:
|
|
244
|
+
|
|
245
|
+
[=] Single agent:
|
|
246
|
+
```bash
|
|
247
|
+
# Build image
|
|
248
|
+
docker build -t integrated-agent:latest .
|
|
249
|
+
|
|
250
|
+
# Run single agent
|
|
251
|
+
docker run -it -v $(pwd)/data:/app/data integrated-agent:latest python
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
[=] Multi agent P2P (Consider docker-compose) :
|
|
255
|
+
- Note: Use the provided [docker-compose.yml](docker-compose.yml) for Quick multi-agent.
|
|
256
|
+
- Navigate to the folder: Use the cd command to enter the directory containing the docker-compose.yml file.
|
|
257
|
+
- ```
|
|
258
|
+
cd /path/to/your/folder
|
|
259
|
+
```
|
|
260
|
+
- run this command to run docker-compose.yml:
|
|
261
|
+
- ```bash
|
|
262
|
+
# Start multiple agents
|
|
263
|
+
docker-compose up -d
|
|
264
|
+
|
|
265
|
+
# View logs
|
|
266
|
+
docker-compose logs -f
|
|
267
|
+
|
|
268
|
+
# Stop all agents
|
|
269
|
+
docker-compose down
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Performance in linux ARM64 Docker Environment/Container
|
|
273
|
+
A. [=] Computational performance results with Transformer included during Advanced prediction method.
|
|
274
|
+
```txt
|
|
275
|
+
== TIME == | CPU % | RAM / RAM LIMIT ||
|
|
276
|
+
|
|
277
|
+
14:50:08.762 0.00% 25.52MiB / 3.71GiB
|
|
278
|
+
14:50:10.339 5.56% 25.52MiB / 3.71GiB
|
|
279
|
+
14:50:12.428 0.17% 25.52MiB / 3.71GiB
|
|
280
|
+
14:50:15.835 103.60% 38.8MiB / 3.71GiB
|
|
281
|
+
14:50:17.844 438.11% 60.15MiB / 3.71GiB
|
|
282
|
+
14:50:19.896 419.36% 68.32MiB / 3.71GiB
|
|
283
|
+
14:50:22.022 434.15% 73.2MiB / 3.71GiB
|
|
284
|
+
14:50:23.969 436.47% 78.18MiB / 3.71GiB
|
|
285
|
+
14:50:25.966 435.85% 80.22MiB / 3.71GiB
|
|
286
|
+
14:50:28.018 430.47% 92.12MiB / 3.71GiB
|
|
287
|
+
14:50:30.029 450.55% 99.5MiB / 3.71GiB
|
|
288
|
+
14:50:32.065 438.06% 105.4MiB / 3.71GiB
|
|
289
|
+
14:50:34.100 469.52% 115.2MiB / 3.71GiB
|
|
290
|
+
14:50:36.109 449.89% 116.8MiB / 3.71GiB
|
|
291
|
+
14:50:38.123 423.56% 119MiB / 3.71GiB
|
|
292
|
+
```
|
|
293
|
+
- [=] Note: To read the full logs (For included Transformer performance): [performance_log_with_TF](performance_log_with_TF.txt)
|
|
294
|
+
- [=] Explanation:
|
|
295
|
+
- Average CPU Usage = 420% - 430% , Sustained roughlt 4.20 - 4.30 CPU Cores
|
|
296
|
+
- Meaning = - Compute-Intensive workload
|
|
297
|
+
- reduced guaranteed of experiencing deadlocks, thread starvation, and major stalls
|
|
298
|
+
- numerical backend is parallelizing efficiently
|
|
299
|
+
- Average RAM Usage = 180 - 195 Mib, Roughly 4.5 - 5% usage of available RAM
|
|
300
|
+
- Meaning = - Very efficient RAM Usage
|
|
301
|
+
- Repeated 269 MiB suggests allocator settled, ndarray pools stabilized, workload reached steady state
|
|
302
|
+
- gradual, safe and steady batch accumulation, reduced possibility of leak explosion.
|
|
303
|
+
|
|
304
|
+
B. [=] Advanced Prediction without Transformer, Only Specialized MLP using AWE.
|
|
305
|
+
```txt
|
|
306
|
+
== TIME == | CPU % | RAM \ RAM LIMIT |
|
|
307
|
+
10:01:37.456 100.44% 269.8MiB / 3.71GiB # initial round 1 training started
|
|
308
|
+
10:01:38.686 101.93% 279.8MiB / 3.71GiB
|
|
309
|
+
10:01:40.694 101.94% 293.2MiB / 3.71GiB
|
|
310
|
+
10:01:42.703 99.90% 302.9MiB / 3.71GiB
|
|
311
|
+
10:01:44.712 99.34% 319.8MiB / 3.71GiB
|
|
312
|
+
10:01:46.721 100.15% 319.7MiB / 3.71GiB
|
|
313
|
+
10:01:48.727 101.91% 319.7MiB / 3.71GiB
|
|
314
|
+
10:01:50.734 100.86% 319.7MiB / 3.71GiB
|
|
315
|
+
10:01:52.742 136.43% 322.9MiB / 3.71GiB
|
|
316
|
+
10:01:54.751 101.91% 324.9MiB / 3.71GiB
|
|
317
|
+
10:01:56.758 100.29% 324.9MiB / 3.71GiB
|
|
318
|
+
10:01:58.769 102.42% 327.1MiB / 3.71GiB
|
|
319
|
+
10:02:00.775 0.00% 329.6MiB / 3.71GiB # First Training and prediction round 1 finished
|
|
320
|
+
10:02:02.788 19.55% 330.1MiB / 3.71GiB # round 2 training
|
|
321
|
+
10:02:04.798 134.23% 332.2MiB / 3.71GiB
|
|
322
|
+
10:02:06.803 108.80% 332.2MiB / 3.71GiB
|
|
323
|
+
10:02:08.811 107.85% 332.2MiB / 3.71GiB
|
|
324
|
+
10:02:10.857 104.43% 332.2MiB / 3.71GiB
|
|
325
|
+
10:02:12.854 101.14% 332.2MiB / 3.71GiB
|
|
326
|
+
10:02:14.858 0.00% 332.3MiB / 3.71GiB
|
|
327
|
+
10:02:16.873 98.84% 333.8MiB / 3.71GiB
|
|
328
|
+
10:02:18.869 0.00% 132.7MiB / 3.71GiB # container stopped and round 2 finished
|
|
329
|
+
```
|
|
330
|
+
- [=] Note: See full performance log in here: [performance_log_only_MLP](performance_log_only_MLP.txt)
|
|
331
|
+
- [=] Explanation:
|
|
332
|
+
- Average CPU Usage = 85-90% Used, sustained roughly 1 CPU Core saturated on average
|
|
333
|
+
- Meaning: - Very efficient computation
|
|
334
|
+
- Much lighter CPU Usage than Transformer.
|
|
335
|
+
- Stable and less parallelizing behavior (Efficient computation)
|
|
336
|
+
- 4.7x lower CPU usage than transformer included
|
|
337
|
+
- Average RAM usage = 314 MiB / 3.71 GiB, Roughly 8.5% usage of available RAM.
|
|
338
|
+
- Meaning: - Slightly larger MiB used than Transformer.
|
|
339
|
+
- Model allocation growth is stable,
|
|
340
|
+
- training buffers stable
|
|
341
|
+
- temporary ndarray growth.
|
|
342
|
+
|
|
343
|
+
### Both performance Overview
|
|
344
|
+
<img width="1536" height="1024" alt="WhatsApp Image 2026-05-24 at 10 27 00" src="https://github.com/user-attachments/assets/9404277f-281f-4893-8367-e494833230ea" />
|
|
345
|
+
|
|
346
|
+
## Source code of AbstractIntegratedModule
|
|
347
|
+
- Note: The source code is provided in the repository.
|
|
348
|
+
- [=] Full Monolithic extensively-documented source code (12K+ Lines): [AbstractIntegratedPipeline-SourceCode.zip](AbstractIntegratedPipeline-SourceCode.zip)
|
|
349
|
+
- [=] Separated Modules of AbstractIntegratedModule: [AbstractIntegratedModule-separated-modules](AbstractIntegratedModule-separated-modules)
|
|
350
|
+
- [~] Note:
|
|
351
|
+
- The source code is open and Free to anyone who:
|
|
352
|
+
- Use it: Run the software for any personal, academic, or commercial purpose.
|
|
353
|
+
- Modify it: Change the source code to fit their needs.
|
|
354
|
+
- Distribute it: Share the original or modified code with others.
|
|
355
|
+
- Commercialize it: Package, brand, and sell the software for profit.
|
|
356
|
+
|
|
357
|
+
## [=] Step's for in-depth Usage
|
|
358
|
+
0. Download via PIP:
|
|
359
|
+
- Clone repository first:
|
|
360
|
+
```bash
|
|
361
|
+
# Clone immediately for Windows and x86_64 only without prerequisites
|
|
362
|
+
git clone https://github.com/Micro-Novelty/IntegratedPipeline-Continous-Learning-AI-Agent-library-framework.git
|
|
363
|
+
cd IntegratedPipeline-Continous-Learning-AI-Agent-library-framework
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
- Install the library via pip:
|
|
367
|
+
```bash
|
|
368
|
+
pip install AbstractIntegratedModule #or
|
|
369
|
+
python -m pip install AbstractIntegratedModule
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
1. Download for binaries:
|
|
373
|
+
- AbstractIntegratedModule.pyd (For Windows) (Python 3.13),
|
|
374
|
+
- AbstractIntegratedModule.cpython-39-x86_64-linux-gnu.so (For linux x86_64) (Python 3.12)
|
|
375
|
+
- AbstractIntegratedModule.cpython-39-aarch64-linux-gnu.so (for Linux ARM64 - Raspberry Pi) (Python 3.10)
|
|
376
|
+
- ```
|
|
377
|
+
# Download from release
|
|
378
|
+
# AbstractIntegratedModule.pyd (windows) /
|
|
379
|
+
# Abstractcpython-39-x86_64-linux-gnu.so (x86_64) /
|
|
380
|
+
# AbstractIntegratedModule.cpython-39-aarch64-linux-gnu.so
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
[=] Steps for installation:
|
|
384
|
+
Note: AbstractIntegratedModule has 5 library dependencies that must be installed on your computer if you use AbstractIntegratedModule binaries:
|
|
385
|
+
- [=] Required Libraries (For binaries usage):
|
|
386
|
+
- Numpy
|
|
387
|
+
- Scikit-learn
|
|
388
|
+
- pandas
|
|
389
|
+
- aiohttp
|
|
390
|
+
- psutil
|
|
391
|
+
|
|
392
|
+
1. Clone repository:
|
|
393
|
+
- ```
|
|
394
|
+
# prerequisites (for Raspberry pi OS Only)
|
|
395
|
+
# Update system
|
|
396
|
+
sudo apt-get update
|
|
397
|
+
sudo apt-get upgrade -y
|
|
398
|
+
|
|
399
|
+
# Install Python 3.13 and development tools
|
|
400
|
+
sudo apt-get install python3.13 python3.13-dev python3.13-venv -y
|
|
401
|
+
|
|
402
|
+
# Install additional build tools
|
|
403
|
+
sudo apt-get install build-essential libatlas-base-dev libjasper-dev -y
|
|
404
|
+
|
|
405
|
+
# Clone immediately for Windows and x86_64 only without prerequisites
|
|
406
|
+
git clone https://github.com/Micro-Novelty/IntegratedPipeline-Continous-Learning-AI-Agent-library-framework.git
|
|
407
|
+
cd IntegratedPipeline-Continous-Learning-AI-Agent-library-framework
|
|
408
|
+
```
|
|
409
|
+
2. Install System Dependencies (for x86_64 installation):
|
|
410
|
+
```
|
|
411
|
+
# Ubuntu/Debian
|
|
412
|
+
sudo apt-get update
|
|
413
|
+
sudo apt-get install python3.13 python3.13-dev python3.13-venv
|
|
414
|
+
|
|
415
|
+
# CentOS/RHEL
|
|
416
|
+
sudo yum install python313 python313-devel
|
|
417
|
+
|
|
418
|
+
# Fedora
|
|
419
|
+
sudo dnf install python3.13 python3.13-devel
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
3. Create a virtual environment:
|
|
423
|
+
- ```
|
|
424
|
+
# Create virtual environment (windows)
|
|
425
|
+
python -m venv venv
|
|
426
|
+
# Activate virtual environment
|
|
427
|
+
venv\Scripts\activate
|
|
428
|
+
|
|
429
|
+
# Create virtual environment (x86_64) (ARM64 / raspberry pi)
|
|
430
|
+
python3.13 -m venv venv
|
|
431
|
+
# Activate virtual environment
|
|
432
|
+
source venv/bin/activate
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
4. Copy AbstractIntegratedModule binary:
|
|
436
|
+
- ```
|
|
437
|
+
# For windows:
|
|
438
|
+
# Copy the .pyd file to your project root
|
|
439
|
+
# AbstractIntegratedModule.pyd
|
|
440
|
+
copy C:\path\to\AbstractIntegratedModule.pyd .\AbstractIntegratedModule.pyd
|
|
441
|
+
|
|
442
|
+
# Copy the .so file to your project root (for x86_64)
|
|
443
|
+
cp /path/to/AbstractIntegratedModule.cpython-39-x86_64-linux-gnu.so ./AbstractIntegratedModule.cpython-39-x86_64-linux-gnu.so
|
|
444
|
+
|
|
445
|
+
# Copy ARM64 / Raspberry pi binary
|
|
446
|
+
cp /path/to/AbstractIntegratedModule.cpython-39-aarch64-linux-gnu.so ./AbstractIntegratedModule.cpython-39-aarch64-linux-gnu.so
|
|
447
|
+
|
|
448
|
+
5. Verify Installation:
|
|
449
|
+
- ```
|
|
450
|
+
python -c "from AbstractIntegratedModule import IntegratedPipeline; print('✓ Installation successful!')"
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
6. Run main.py for quick test of successful imports:
|
|
454
|
+
- ```
|
|
455
|
+
# run this for quick import test.
|
|
456
|
+
python main.py
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
3. Create CSV file that contains training labels and titles:
|
|
462
|
+
- Example format:
|
|
463
|
+
```txt
|
|
464
|
+
window_title,label
|
|
465
|
+
"Thesis.docx",focused_work,high,writing-thesis
|
|
466
|
+
"Microsoft Excel",work,medium,data-analysis
|
|
467
|
+
"YouTube -> Google Chrome",distracted,high,watching-videos
|
|
468
|
+
"Slack",communication,high,team-chat
|
|
469
|
+
"VSCode", focused_work,high,coding
|
|
470
|
+
"netflix.com -> Google Chrome",break,high,Netflix-break
|
|
471
|
+
"Outlook",work,medium,checking-email
|
|
472
|
+
"System Settings",system designing,low,configuring-computer
|
|
473
|
+
"GitHub",creating-and-editing-repo,research
|
|
474
|
+
"README.md -> VS Code",focused_work,medium,reading-docs
|
|
475
|
+
"Amazon.com -> Chrome",personal-work,high,shopping
|
|
476
|
+
```
|
|
477
|
+
Note = window_title is target_title and label is target_label, check step below to use it.
|
|
478
|
+
|
|
479
|
+
4. Use IntegratedPipeline as in this example:
|
|
480
|
+
```python
|
|
481
|
+
from AbstractIntegratedModule import IntegratedPipeline
|
|
482
|
+
from AbstractIntegratedModule import PipelinePredictionManager
|
|
483
|
+
import numpy as np
|
|
484
|
+
|
|
485
|
+
memory_name = 'agent_memory'
|
|
486
|
+
main_model = IntegratedPipeline(
|
|
487
|
+
memory_name=memory_name, # memory name for the AI you already initialized
|
|
488
|
+
use_async=True, # local asynchronous prediction is permitted, if not PipelineAsyncManager wont start asynchronous prediction.
|
|
489
|
+
agent_port=5001, # this port is used to set AgentDistributedInference server (optional)
|
|
490
|
+
singleton_permitted=False, # set IntegratedPipeline to singleton if you don't use it for P2P, False if you use P2P.
|
|
491
|
+
ssl_cert_file=cert_file, ssl_key_file=key_file) # provide your cert_file path or key_file path (optional)
|
|
492
|
+
|
|
493
|
+
main_prediction = PipelinePredictionManager(
|
|
494
|
+
main_model, # your initialized pipeline
|
|
495
|
+
label_csv='example_manual_training.txt', # your .txt file that contains CSV format.
|
|
496
|
+
target_title='window_title', label='label')
|
|
497
|
+
|
|
498
|
+
# example_manual_training is a .txt file that contain csv format like above example.
|
|
499
|
+
|
|
500
|
+
# rules will be used to create automatic dataset for IntegratedPipeline.
|
|
501
|
+
example_rules = [
|
|
502
|
+
# === WORK / PRODUCTIVITY ===
|
|
503
|
+
(r'code|programming|develop|debug|compile|script', 'focused_work'),
|
|
504
|
+
(r'vscode|visual_studio|ide|terminal|shell', 'focused_work'),
|
|
505
|
+
(r'notion|evernote|onenote|notes|todo|task', 'productive'),
|
|
506
|
+
(r'slack|teams|discord|zoom|meeting|call', 'communication'),
|
|
507
|
+
(r'email|gmail|outlook|inbox|mail', 'communication'),
|
|
508
|
+
|
|
509
|
+
# === ENTERTAINMENT ===
|
|
510
|
+
(r'youtube|netflix|twitch|stream|video', 'entertainment'),
|
|
511
|
+
(r'music|spotify|soundcloud|audio|player', 'entertainment'),
|
|
512
|
+
(r'game|gaming|steam|epic|play', 'gaming'),
|
|
513
|
+
(r'facebook|instagram|tiktok|social|post', 'social_media'),
|
|
514
|
+
|
|
515
|
+
# === BROWSING ===
|
|
516
|
+
(r'chrome|firefox|edge|safari|browser', 'browsing'),
|
|
517
|
+
(r'google|search|wiki|wiki|article', 'information'),
|
|
518
|
+
(r'stackoverflow|github|docs|documentation', 'research'),
|
|
519
|
+
|
|
520
|
+
# more rules
|
|
521
|
+
]
|
|
522
|
+
|
|
523
|
+
# activate explainability capability to explain uncertainty:
|
|
524
|
+
main_model.show_explainability_details = True
|
|
525
|
+
main_model.distribution.predict_manager = main_prediction # set PipelinePredictionManager to AgentDistributedInference for asynchronous prediction later (Very important for asynchronous prediction)
|
|
526
|
+
# main_model.use_transformer = True if you want to use transformer, this will notify all modules that used advanced_prediction_method will initiate prediction with both transformer and MLP.
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
# test samples with more sophisticated rules and more complex titles for prediction
|
|
530
|
+
# (title, intent)
|
|
531
|
+
test_titles = [
|
|
532
|
+
("Opening Thesis.docx", "slight_work"),
|
|
533
|
+
("Watching YouTube and Google Chrome", "distracted"),
|
|
534
|
+
("Watching Slack", "communication"),
|
|
535
|
+
("Programming in Visual Studio Code", "focused_work"),
|
|
536
|
+
("Watching netflix.com - Chrome", "break"),
|
|
537
|
+
# more titles
|
|
538
|
+
]
|
|
539
|
+
|
|
540
|
+
titles, y, label_map = main_prediction.load_labels_from_csv(
|
|
541
|
+
<your_filename.>, # the name of your .txt file with CSV format.
|
|
542
|
+
<target_title>, <target_label>)
|
|
543
|
+
|
|
544
|
+
# small training with simple titles first
|
|
545
|
+
main_model.train(titles, y)
|
|
546
|
+
|
|
547
|
+
results, chosen_label, confidence = main_prediction.advanced_prediction_method(
|
|
548
|
+
test_titles, label_map, example_rules,
|
|
549
|
+
show_proba=False, top_k=3,
|
|
550
|
+
use_transformer=True,
|
|
551
|
+
return_attention=False,
|
|
552
|
+
save_results=True,
|
|
553
|
+
batch_size=2)
|
|
554
|
+
# batch size=2 is needed during transformer training for batching, if you have larger samples consider using batch_size > 8, for medium amount of samples (>10 -> <50 samples) consider using 2 or 4 batch_size.
|
|
555
|
+
# ... more features you can add
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
5. To use IntegratedPipeline prediction without Transformer, Only Specialized MLP:
|
|
559
|
+
Note: IntegratedPipeline without Transformer is'nt recommended due to it being weak at certain contextual prediction's, excel's at classification task's.
|
|
560
|
+
- Example without transformer:
|
|
561
|
+
```python
|
|
562
|
+
prediction_result = main_prediction.advanced_prediction_method(
|
|
563
|
+
[t[0] for t in test_titles], # titles is enough for MLP Classification.
|
|
564
|
+
label_map,
|
|
565
|
+
example_rules,
|
|
566
|
+
show_proba=True
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
```
|
|
570
|
+
6. Asynchronous prediction:
|
|
571
|
+
- Asynchronous prediction request is important and is critical because it keeps prediction interfaces responsive, maximizes local hardware efficiency, and enables apps to handle background tasks seamlessly without waiting on remote server responses,
|
|
572
|
+
- for asynchronous prediction handling, consider using this setup
|
|
573
|
+
```python
|
|
574
|
+
# Step 2
|
|
575
|
+
from AbstractIntegratedModule import PipelineAsyncManager
|
|
576
|
+
from AbstractIntegratedModule import SecurityConfig
|
|
577
|
+
from AbstractIntegratedModule import SecurityLevel
|
|
578
|
+
|
|
579
|
+
print(" = TESTING ASYNCHRONOUS PREDICTION MANAGER = ")
|
|
580
|
+
# Set discovery secret (in production, use environment variable)
|
|
581
|
+
secret_key = 'my-ultra-safe-secret-key-for-authentication' # you can customize this key
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
security_config = SecurityConfig(
|
|
585
|
+
max_text_length=10000, # can be extended
|
|
586
|
+
max_queue_size=100, # can be extended
|
|
587
|
+
rate_limit_requests=60, # 60 per minute
|
|
588
|
+
require_api_key=True, #
|
|
589
|
+
max_pending_tasks=50,
|
|
590
|
+
request_timeout=60.0,
|
|
591
|
+
|
|
592
|
+
# Start with no IP restrictions, you can add allowed IPs for asynchronous prediction externally, boothstrap_auth for better security
|
|
593
|
+
allowed_ips=[],
|
|
594
|
+
blocklisted_ips=[],
|
|
595
|
+
require_bootstrap_auth = False # true for better security (Not recommended, cause less flexibility)
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
async_manager = PipelineAsyncManager(main_model,
|
|
599
|
+
main_prediction, # your previous initialized PipelinePredictionManager
|
|
600
|
+
config=security_config,
|
|
601
|
+
state_file=None, # state file is used to load known security logs ex: ip used, ip blacklisted, etc.
|
|
602
|
+
security_level=SecurityLevel.PRODUCTION, # production level security initiated
|
|
603
|
+
api_key=secret_key #set secret key you initialized
|
|
604
|
+
max_workers=4, # workers to initiate asynchronous tasks, more workers, more capabilities to process asynchronous prediction requests.
|
|
605
|
+
task_timeout=30,
|
|
606
|
+
max_retries=3 ) # retries after failure during prediction
|
|
607
|
+
|
|
608
|
+
async_manager.start(method='Transformer_included', bootstrap_token=None) # boothstrap token is optional for better security
|
|
609
|
+
|
|
610
|
+
texts = {'test_titles': test_titles, 'label_map': label_map, 'rules': example_rules, 'use_transformer': True}
|
|
611
|
+
regular_predict = async_manager.predict(
|
|
612
|
+
texts=texts,
|
|
613
|
+
timeout=60,
|
|
614
|
+
retries=None,
|
|
615
|
+
api_key=secret_key) # advanced prediction method for asynchronous prediction.
|
|
616
|
+
|
|
617
|
+
# with retries: async_manager.predict(texts, timeout=60, retries=5, api_key=secret_key) # 5 times retry if failed
|
|
618
|
+
|
|
619
|
+
print('[==] Initiating advanced batch prediction')
|
|
620
|
+
predicted_output = async_manager.advanced_batch_prediction(test_titles, label_map, example_rules, secret_key, client_ip=None) # you can add client_ip to provide a robust authentication paired with secret_key
|
|
621
|
+
# for better and faster advanced prediction, consider using advanced batch prediction like in the above example
|
|
622
|
+
|
|
623
|
+
```
|
|
624
|
+
[=] Note:
|
|
625
|
+
- Asynchronous prediction used Event loop that handles incoming request, There are conditions where event loop will not start and can't accet requests:
|
|
626
|
+
- CPU Above > 95% - Disk space is < 100 MB
|
|
627
|
+
- RAM above > 95%
|
|
628
|
+
- When event loop is not triggered, Asynchronous prediction can't be initiated and must be restarted/retried.
|
|
629
|
+
|
|
630
|
+
7. Peer-to-Peer Probability coordination:
|
|
631
|
+
- Each peer is both server and client simultaneously for robustness and resilience during during P2P.
|
|
632
|
+
- To Make the Agent cooperate with other peers, consider using this setup:
|
|
633
|
+
- [=] for ensemble prediction from multiple peers, exchanging predicted label with each other, consider using this setup:
|
|
634
|
+
```python
|
|
635
|
+
|
|
636
|
+
# step 3
|
|
637
|
+
from AbstractIntegratedModule import CohesiveAgentDeployment
|
|
638
|
+
from AbstractIntegratedModule import PipelinePredictionManager
|
|
639
|
+
import asyncio
|
|
640
|
+
import traceback
|
|
641
|
+
|
|
642
|
+
prediction_manager = PipelinePredictionManager(main_model, label_csv=<your_training_labels.txt>, target_title=<target_title>, label=<target_label>)
|
|
643
|
+
|
|
644
|
+
print("=== SECURE PEER-TO-PEER CLUSTER ===")
|
|
645
|
+
|
|
646
|
+
# CohesiveAgentDeployment is deeply tied and coupled with AgentDistributedInference,
|
|
647
|
+
# if you already set an SSL cert and key, CohesiveAgentDeployment will use the SSL directly from AgentDistributedInference
|
|
648
|
+
# allowing secure socket to be used directly by CohesiveAgentDeployment
|
|
649
|
+
|
|
650
|
+
main_model.distribution.enable_ssl = False # set to false if you dont have SSL key and CERT, this code would instruct AgentDistributedInference that you don't have SSL, and provide you a regular unsecured socket (Not necessary for production)
|
|
651
|
+
|
|
652
|
+
# Agent 1 - Primary (Port 5555)
|
|
653
|
+
agent1 = CohesiveAgentDeployment(
|
|
654
|
+
pipeline=main_model, # main_model is your initialized integrated pipeline
|
|
655
|
+
memory_name="agent_primary", # any name you want for the agent.
|
|
656
|
+
filename=<filename>, # name of your .txt file that contains the CSV format and training labels
|
|
657
|
+
target_title=<title_name>,
|
|
658
|
+
label_name=<label_name>,
|
|
659
|
+
security_level="PRODUCTION", # production level security
|
|
660
|
+
enable_peers=True, # allow peer discovery
|
|
661
|
+
trusted_networks=['127.0.0.1/32', '192.168.1.0/24'], # for trusted networks, you need to provide the list of IPs of your peers.
|
|
662
|
+
peer_discovery_port=5555, # peer port to start P2P
|
|
663
|
+
secret_key=secret_key, # your secret key
|
|
664
|
+
shared_auth_token=secret_key, # your previous initialized secret_key
|
|
665
|
+
predict_manager=prediction_manager, # your prediction manager
|
|
666
|
+
peer_config = <'your_peer_ip_lists.json'> # you need to create .json file that contains your peer IP and Port lists
|
|
667
|
+
consecutive_peer_config = <'your_second_fallback_peer_ip_lists.json'> # same for this one too, but for fallback.
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
# Agent 2 - Secondary (Port 5556)
|
|
671
|
+
agent2 = CohesiveAgentDeployment(
|
|
672
|
+
pipeline=main_model,
|
|
673
|
+
memory_name="agent_secondary",
|
|
674
|
+
filename=<filename>,
|
|
675
|
+
target_title=<title_name>,
|
|
676
|
+
label_name=<label_name>,
|
|
677
|
+
security_level="PRODUCTION",
|
|
678
|
+
enable_peers=True, # agent is allowed to find peers
|
|
679
|
+
trusted_networks=['127.0.0.1/32', '192.168.1.0/24'],
|
|
680
|
+
peer_discovery_port=5556,
|
|
681
|
+
secret_key=secret_key,
|
|
682
|
+
shared_auth_token=secret_key,
|
|
683
|
+
predict_manager=prediction_manager,
|
|
684
|
+
peer_config = <'your_peer_ip_lists.json'> # you need to create .json file that contains your peer IP and Port lists
|
|
685
|
+
consecutive_peer_config = <'your_second_fallback_peer_ip_lists.json'> # same for this one too, but for fallback.
|
|
686
|
+
)
|
|
687
|
+
|
|
688
|
+
# Note: CohesiveAgentDeployment contains ConsecutivePeerAgent that can start a server once ensemble prediction from peer is started
|
|
689
|
+
# be advised to stop the server too before shutdown-ing CohesiveAgentDeployment cluster
|
|
690
|
+
|
|
691
|
+
# example peer_Ip_lists_config.json (de-comment to use)
|
|
692
|
+
# {
|
|
693
|
+
# you must put "known_peers" in the config so python can identify the list of IPs and Ports
|
|
694
|
+
# "known_peers": [
|
|
695
|
+
# ["127.0.0.1", 5555], can be modified using real IP or local IP.
|
|
696
|
+
# ["127.0.0.1", 5556]
|
|
697
|
+
# ]
|
|
698
|
+
# }
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
try:
|
|
702
|
+
# Start both agents
|
|
703
|
+
print("\n🚀 Starting Agent 1...")
|
|
704
|
+
await agent1.start()
|
|
705
|
+
print("✅ Agent 1 started on port 5555")
|
|
706
|
+
|
|
707
|
+
print("\n🚀 Starting Agent 2...")
|
|
708
|
+
await agent2.start()
|
|
709
|
+
print("✅ Agent 2 started on port 5556")
|
|
710
|
+
|
|
711
|
+
# Give servers time to fully bind
|
|
712
|
+
await asyncio.sleep(2)
|
|
713
|
+
|
|
714
|
+
# Get API keys
|
|
715
|
+
api_key = agent1.get_api_key()
|
|
716
|
+
print(f"\n🔑 Using API Key: {api_key[:20]}...")
|
|
717
|
+
|
|
718
|
+
texts = {"test_titles": test_titles, "label_map": label_map, "rules": rules, "use_transformer": True, "agent_id": agent_id}
|
|
719
|
+
|
|
720
|
+
# texts dictionary must contain test_titles, label_map, and rules that you can assign,
|
|
721
|
+
# agent ID can be strings, int, or floats, recommendded to make it long for better security.
|
|
722
|
+
|
|
723
|
+
# Make prediction with peer ensemble
|
|
724
|
+
# Connection will be guaranteed successfull during discovery.
|
|
725
|
+
result = await agent1.multi_modal_peer_ensemble_prediction(
|
|
726
|
+
texts=texts,
|
|
727
|
+
api_key=api_key,
|
|
728
|
+
method='advanced',
|
|
729
|
+
disable_sync=True
|
|
730
|
+
) # await using asyncio, multi_modal_peer_ensemble is already async by design (Inside ConsecutivePeerAgent), no need to put asyncio.run()
|
|
731
|
+
|
|
732
|
+
# must have agent2 peer ensemble function after agent1 peer ensemble prediction function,
|
|
733
|
+
# so agent1 can receive agent2 peer ensemble prediction request.
|
|
734
|
+
result2 = await agent2.multi_modal_peer_ensemble_prediction(
|
|
735
|
+
texts=texts,
|
|
736
|
+
api_key=api_key,
|
|
737
|
+
method='advanced',
|
|
738
|
+
disable_sync=True
|
|
739
|
+
)
|
|
740
|
+
|
|
741
|
+
print(f"\n📊 Ensemble Result for Agent 1:")
|
|
742
|
+
print(f" Prediction: {result.get('prediction', 'N/A')}")
|
|
743
|
+
print(f" Confidence: {result.get('confidence', 0):.2%}")
|
|
744
|
+
|
|
745
|
+
print(f"\n📊 Ensemble Result for Agent 2:")
|
|
746
|
+
print(f" Prediction: {result2.get('prediction', 'N/A')}")
|
|
747
|
+
print(f" Confidence: {result2.get('confidence', 0):.2%}")
|
|
748
|
+
|
|
749
|
+
# Keep running briefly
|
|
750
|
+
print("\n⏳ Cluster stable. Waiting 5 seconds before shutdown...") # 5 seconds before shutdown.
|
|
751
|
+
|
|
752
|
+
# stop ConsecutivePeerAgent servers inside CohesiveAgentDeployment.
|
|
753
|
+
agent1._peer_agent.stop_server() # ._peer_agent is ConsecutivePeerAgent
|
|
754
|
+
agent2._peer_agent.stop_server()
|
|
755
|
+
|
|
756
|
+
await asyncio.sleep(5)
|
|
757
|
+
|
|
758
|
+
except Exception as e:
|
|
759
|
+
print(f"\n❌ Error in cluster: {e}")
|
|
760
|
+
traceback.print_exc()
|
|
761
|
+
|
|
762
|
+
finally:
|
|
763
|
+
print("\n🛑 Shutting down cluster...")
|
|
764
|
+
await agent1.shutdown()
|
|
765
|
+
await agent2.shutdown()
|
|
766
|
+
print("✅ Cluster shutdown complete")
|
|
767
|
+
|
|
768
|
+
```
|
|
769
|
+
[=] Important Note:
|
|
770
|
+
- This setup outputs the given predicted label of an input directly, making P2P more flexible and fast.
|
|
771
|
+
- This setup used Hybrid feature in prediction handling, Asynchronous prediction request, and Synchronous prediction handling. Synchronous prediction does block code execution for a few seconds, it was used for a few reason here, such as:
|
|
772
|
+
- allowing a more slower traffic between agents, preventing other agent to get the same peer prediction over time, making each interaction equals and each peer can receive different peer prediction output.
|
|
773
|
+
|
|
774
|
+
[=] You can download this setup here for a direct test: [P2PDirectTest.py](P2PDirectTest.py)
|
|
775
|
+
|
|
776
|
+
- [=] for probability coordination, locally, get peers data from database or via socket.
|
|
777
|
+
```python
|
|
778
|
+
# step 4
|
|
779
|
+
dataset, _ = main_model.data_preparation(test_titles, label_map)
|
|
780
|
+
sequence_inputs = main_model.sequence_encoding(dataset)
|
|
781
|
+
X_raw_generation, y, n_classes, input_dim = main_model.mlp_training_features(example_rules, dataset)
|
|
782
|
+
|
|
783
|
+
main_model.initialize_fitting(dataset)
|
|
784
|
+
X_raw_features = main_model.tfidf.transform(X_raw_generation).toarray()
|
|
785
|
+
transformer_features = main_model.transformer_pooled_features(sequence_inputs)
|
|
786
|
+
X_features = np.concatenate([X_raw_features, transformer_features], axis=-1)
|
|
787
|
+
|
|
788
|
+
peer_probability_calibration = main_model.predict_proba(sequence_inputs, X_features, type='Hybrid', embedded=True) # peer-to-peer calibration is inside this function
|
|
789
|
+
```
|
|
790
|
+
[~] Note: the peer calibration coordination has a chance of triggering if both MLP and Transformer prediction doesn't agree on certain output. Consider using this setup below for using stand-alone peer-to-peer main function without being wrapped in other parent function, allowing flexible and auditable peer-to-peer sharing for probability coordination:
|
|
791
|
+
```python
|
|
792
|
+
from AbstractIntegratedModule import WeightedEnsemblePredictor
|
|
793
|
+
from AbstractIntegratedModule import Transformer
|
|
794
|
+
|
|
795
|
+
num_classes = len(label_map)
|
|
796
|
+
# if you haven't fit the Tfidf:
|
|
797
|
+
# main_model.initialize_fitting(dataset)
|
|
798
|
+
|
|
799
|
+
ensemble_method = WeightedEnsemblePredictor(main_model, memory_name) # consider using the same memory name used in your previous pipeline
|
|
800
|
+
transformer = Transformer(main_model.vocab_size, d_model=32, n_heads=4, num_classes=num_classes) # you can audit how much parameter the transformer needs.
|
|
801
|
+
main_model.model2 = transformer # overwrite previous transformer initialization
|
|
802
|
+
|
|
803
|
+
# main_model.distribution is AgentDistributedInference() class
|
|
804
|
+
# consider using ssl for secure peer to peer coordination
|
|
805
|
+
main_model.distribution.ssl_cert_file = <path_to_your_ssl_cert_file>
|
|
806
|
+
main_model.distribution.ssl_key_file = <path_to_your_ssl_key_file>
|
|
807
|
+
|
|
808
|
+
dataset, _ = main_model.data_preparation(titles, label_map)
|
|
809
|
+
sequence_input = main_model.sequence_encoding(dataset)
|
|
810
|
+
_, attn_weights = transformer.forward(sequence_input)
|
|
811
|
+
|
|
812
|
+
probs = ensemble_method.predict_ensemble(sequence_input, X_features, y, method='dynamic', embedded=True)
|
|
813
|
+
# 3 options for ensemble weighting method:
|
|
814
|
+
# 1. dynamic: allow flexible, efficient weighting from both transformer and MLP,
|
|
815
|
+
# 2. meta: for a much more in-depth weighting from both model,
|
|
816
|
+
# 3. calibration: allow calibrating probability for both model outputs based on both best weights assembling.
|
|
817
|
+
|
|
818
|
+
agreement = main_model.agreement
|
|
819
|
+
|
|
820
|
+
# start server to initiate socket for P2P listener
|
|
821
|
+
main_model.distribution.start_server()
|
|
822
|
+
|
|
823
|
+
# set connection timeout (Optional)
|
|
824
|
+
main_model.distribution.connection_timeout = 30 # 30 seconds before timeout
|
|
825
|
+
calibrated_probability = main_model._handle_distributed_connections(probs, attn_weights, sequence_input, agreement)
|
|
826
|
+
|
|
827
|
+
# if an Agent experience a failure on tasks, consider using this function to reduce peer trust for safer flexible coordination:
|
|
828
|
+
# main_model.distribution.report_failure(id(main_model), '<task_name>', reason='<unknown>') # you can add the task_name and reason
|
|
829
|
+
# main_model.distribution.print_network_status() # to show other peers info.
|
|
830
|
+
```
|
|
831
|
+
[~] Note: this calibrated_probability is later used to calculate confidence and chosen output based on given label_map.
|
|
832
|
+
- Consider checking:
|
|
833
|
+
- [multi_agent_client.py](multi_agent_client.py) for a In-depth start for client testing.
|
|
834
|
+
- [multi_agent_server.py](multi_agent_server.py) for a In-depth start for server testing.
|
|
835
|
+
- If you get undefined NoneType Behavior when using .accept(), consider see [Troubleshooting](#Troubleshooting) Issue 7 for a Quick fix.
|
|
836
|
+
|
|
837
|
+
6. Cross-Session availability:
|
|
838
|
+
- To use Cross-session avialability to transfer or import memory, consider using this setup:
|
|
839
|
+
- ```python
|
|
840
|
+
main_model._cross_session_availability() # cross session capability function
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
7. As an option, You can add more feature's directly to what it should predict, behave using rules you have given, Create a visual dashboard, create a distributed mesh of this agent, and much more features you can try.
|
|
844
|
+
|
|
845
|
+
## [+] Troubleshooting
|
|
846
|
+
1. Issue 1: "ModuleNotFoundError: No module named 'AbstractIntegratedModule'" When using the binary version of the library,
|
|
847
|
+
Solution:
|
|
848
|
+
|
|
849
|
+
- [=] Verify the binary file is in the correct location:
|
|
850
|
+
```
|
|
851
|
+
ls -la AbstractIntegratedModule*.so # Linux
|
|
852
|
+
dir AbstractIntegratedModule.pyd # Windows
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
- [=] Check Python path:
|
|
857
|
+
```
|
|
858
|
+
python -c "import sys; print('\n'.join(sys.path))"
|
|
859
|
+
```
|
|
860
|
+
- [~] Note: - Move binary to project root if not already there
|
|
861
|
+
- Ensure you're using Python 3.13 of the supported version.
|
|
862
|
+
|
|
863
|
+
2. Issue 2: "ImportError: DLL load failed" when using binary version of the library (For Windows)
|
|
864
|
+
Solution:
|
|
865
|
+
|
|
866
|
+
- 1. Ensure AbstractIntegratedModule.pyd is in your project root
|
|
867
|
+
- 2. Install Visual C++ redistributables:
|
|
868
|
+
Download from: https://support.microsoft.com/en-us/help/2977003
|
|
869
|
+
- 3. Verify Python architecture (32-bit vs 64-bit) matches the .pyd file
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
3. Issue 3: "Permission denied" when using binary version of the library (for Linux/Raspberry Pi)
|
|
873
|
+
[=] Solution:
|
|
874
|
+
- ```
|
|
875
|
+
# Make sure you have read permissions
|
|
876
|
+
chmod 644 AbstractIntegratedModule.cpython-39-*.so
|
|
877
|
+
# If in virtual environment, ensure it's activated
|
|
878
|
+
source venv/bin/activate
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
4. Issue 4: Missing Dependencies when using binary
|
|
882
|
+
[=] Solution:
|
|
883
|
+
- ```
|
|
884
|
+
# Reinstall all dependencies
|
|
885
|
+
pip install --upgrade pip setuptools wheel
|
|
886
|
+
pip install numpy pandas scikit-learn matplotlib scipy requests
|
|
887
|
+
|
|
888
|
+
# Verify installation
|
|
889
|
+
pip list
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
5. Issue 5: Virtual Environment Issues
|
|
893
|
+
[=] Solution:
|
|
894
|
+
- ```
|
|
895
|
+
# Deactivate current environment
|
|
896
|
+
deactivate
|
|
897
|
+
|
|
898
|
+
# Create a fresh virtual environment
|
|
899
|
+
python -m venv fresh_venv
|
|
900
|
+
|
|
901
|
+
# Activate it
|
|
902
|
+
source fresh_venv/bin/activate # Linux/Raspberry Pi
|
|
903
|
+
# or
|
|
904
|
+
fresh_venv\Scripts\activate # Windows
|
|
905
|
+
|
|
906
|
+
# Reinstall
|
|
907
|
+
pip install --upgrade pip
|
|
908
|
+
pip install numpy pandas scikit-learn matplotlib scipy
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
6. Issue 6: Raspberry Pi - "Bus error" or Performance Issues
|
|
912
|
+
Solution:
|
|
913
|
+
- [=] Ensure adequate swap space:
|
|
914
|
+
```
|
|
915
|
+
free -h # Check current swap
|
|
916
|
+
sudo nano /etc/dphys-swapfile # Increase if needed
|
|
917
|
+
```
|
|
918
|
+
- Close unnecessary applications before running
|
|
919
|
+
- Consider using a faster SD card (UHS-I or better)
|
|
920
|
+
|
|
921
|
+
7. Issue 7: P2P Undefined Connection:
|
|
922
|
+
If you get this warning:
|
|
923
|
+
- ```
|
|
924
|
+
[❌] Failed to connect to <host>:<port>: Nonetype object has no attribute .accept()
|
|
925
|
+
```
|
|
926
|
+
- [=] Solution:
|
|
927
|
+
- ```
|
|
928
|
+
# initiate socket first
|
|
929
|
+
main_model.distribution.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
930
|
+
main_model.distribution.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
931
|
+
main_model.distribution.socket.bind(('0.0.0.0', self.port)) # self.port could be changed with other ports
|
|
932
|
+
main_model.distribution.socket.listen(5) # listens for 5 seconds
|
|
933
|
+
```
|
|
934
|
+
8. Issue 8: Cannot compare using '<' with str and float data:
|
|
935
|
+
- This happens when one of the labels extracted from your CSV file has NaN value, consider replace NaN with actual labels.
|
|
936
|
+
|
|
937
|
+
9. Issue 9: Failed authentication during asynchronous prediction:
|
|
938
|
+
- Solution: Ensure API_KEY is initialized inside PipelineAsyncManager like this:
|
|
939
|
+
- ```python
|
|
940
|
+
async_manager = PipelineAsyncManager(main_model,
|
|
941
|
+
main_prediction, # your previous initialized PipelinePredictionManager
|
|
942
|
+
config=security_config,
|
|
943
|
+
state_file=None, # state file is used to load known security logs ex: ip used, ip blacklisted, etc.
|
|
944
|
+
security_level=SecurityLevel.PRODUCTION, # production level security initiated
|
|
945
|
+
api_key=secret_key # set secret key you initialized <- THIS IS IMPORTANT
|
|
946
|
+
max_workers=4, # workers to initiate prediction, more workers, more capabilities to process prediction requests.
|
|
947
|
+
task_timeout=30,
|
|
948
|
+
max_retries=3 ) # retries after failure during prediction
|
|
949
|
+
```
|
|
950
|
+
- And make sure you also initialized api_key in the predict function that requires api_key:
|
|
951
|
+
```
|
|
952
|
+
async_manager.predict(...., ...., api_key=api_key, ...)
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
## [=] Detailed process of Alpha-computing
|
|
956
|
+
|
|
957
|
+
<img width="720" height="338" alt="WhatsApp Image 2026-05-04 at 17 43 35" src="https://github.com/user-attachments/assets/3d149dce-cf3b-44c9-80b0-fa68290a2019" />
|
|
958
|
+
|
|
959
|
+
<img width="720" height="388" alt="WhatsApp Image 2026-05-04 at 17 44 04" src="https://github.com/user-attachments/assets/b1efedf6-5aa1-431e-89da-5f422549b453" />
|
|
960
|
+
🧠 What Alpha-Based Computation Actually Does
|
|
961
|
+
|
|
962
|
+
At its core, alpha (α) is a control parameter that blends two different information paths inside a given transformer:
|
|
963
|
+
A_final = α · A_fixed + (1 − α) · A_learned.
|
|
964
|
+
[~] Where:
|
|
965
|
+
- A_fixed → stable, non-trainable (or minimally changing) attention
|
|
966
|
+
- A_learned → dynamic, trainable attention (Q, K, V)
|
|
967
|
+
- α ∈ [0, 1] → controls how much each path contributes
|
|
968
|
+
|
|
969
|
+
[~] Forward Pass -> Controlling Information Flow:
|
|
970
|
+
During the forward pass, alpha determines what representation the model uses.
|
|
971
|
+
If α is high (e.g., 0.8–1.0): Model relies mostly on stable attention
|
|
972
|
+
→ outputs are consistent → less noise → safer early training, If α is low (e.g., 0.0–0.3), Model relies mostly on learned attention, → more expressive → but unstable early on.
|
|
973
|
+
So in forward propagation, alpha is essentially, “How much do I trust learned attention vs safe attention?”
|
|
974
|
+
|
|
975
|
+
[~] Backward Pass -> Controlling Gradient Flow:
|
|
976
|
+
When gradients flow backward:
|
|
977
|
+
```
|
|
978
|
+
- dA_final → splits into two paths
|
|
979
|
+
- Mathematically:
|
|
980
|
+
- dA_fixed = α · dA_final
|
|
981
|
+
- dA_learned = (1 − α) · dA_final
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
[~] Simple Explanation:
|
|
985
|
+
1. If α (alpha) is high: → most gradient goes to fixed path → learned attention gets very little update → training is stable but slow
|
|
986
|
+
2. If α is low: → most gradient goes to learned attention → fast learning → but noisy / unstable
|
|
987
|
+
|
|
988
|
+
[=] Why This Matters for Training
|
|
989
|
+
1. Without alpha: attention starts random → gradients noisy → model stuck (~10% accuracy)
|
|
990
|
+
2. With alpha: early stage -> rely on stable structure → meaningful gradients
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
## Main Components
|
|
995
|
+
[=] 1. - Consider checking and run: [IntegratedPipeline_Flow.html](IntegratedPipeline_Flow.html) regarding each function of the whole components and deep-dive mechanism.
|
|
996
|
+
2. - consider checking [ARCHITECTURE.md](ARCHITECTURE.md) for more explanation about the main components.
|
|
997
|
+
|
|
998
|
+
[=] With 20 total architectures working together as a standalone library that is efficient and robust, Main components include:
|
|
999
|
+
|
|
1000
|
+
1. GeometricWeightShaping
|
|
1001
|
+
Purpose: Analyzes the geometric structure of data (anisotropy, spectral properties, complexity) and generates optimal weight matrices based on that geometry. Essentially teaches the model how to "understand" the shape of data before processing it, Highly robust to noise, making it an excellent fit for messy environment.
|
|
1002
|
+
---
|
|
1003
|
+
2. Activation
|
|
1004
|
+
Purpose: Provides standard neural network activation functions (ReLU, sigmoid, softmax) and their derivatives for backpropagation for MLP Class.
|
|
1005
|
+
---
|
|
1006
|
+
3. Loss
|
|
1007
|
+
Purpose: Implements categorical crossentropy loss and its gradient for training classification models for both MLP and The Transformer
|
|
1008
|
+
---
|
|
1009
|
+
4. Transformer
|
|
1010
|
+
Purpose: A complete transformer implementation with multi-head attention, positional embeddings, feed-forward networks, layer normalization, and custom backpropagation. Includes both fixed (stable) and dynamic (adaptive) training modes necessary for Scarce data environment using algorithm such as Alpha based computing directly during forward pass.
|
|
1011
|
+
---
|
|
1012
|
+
5. Dense
|
|
1013
|
+
Purpose: A geometric-aware dense layer that adapts its weights based on input data geometry and handles variable input dimensions automatically.
|
|
1014
|
+
---
|
|
1015
|
+
6. SoftmaxOutput
|
|
1016
|
+
Purpose: A simple wrapper around softmax activation that stores the output and passes gradients through unchanged (since softmax + crossentropy gradient is handled elsewhere).
|
|
1017
|
+
---
|
|
1018
|
+
7. MLP
|
|
1019
|
+
Purpose: A multi-layer perceptron that can switch between standard training and "focused" training (using feed-forward layers only) based on data complexity. Includes prediction, scoring, and geometric measurement methods.
|
|
1020
|
+
---
|
|
1021
|
+
8. WeightedEnsemblePredictor
|
|
1022
|
+
Purpose: Combines Transformer and MLP predictions using dynamic weighting based on attention quality, model confidence, and agreement. Also manages memory storage, explainability, and peer agent communication.
|
|
1023
|
+
---
|
|
1024
|
+
9. CrossSessionAutomation
|
|
1025
|
+
Purpose: Manages exporting, importing, and syncing model sessions across different devices or time periods. Allows saving entire model states to JSON and transferring them over network sockets.
|
|
1026
|
+
---
|
|
1027
|
+
10. ExplainabilityModule
|
|
1028
|
+
Purpose: Generates human-readable explanations for predictions, learns from user feedback, maintains decision history, and batch-trains on corrections. The transparency layer for the AI agent.
|
|
1029
|
+
---
|
|
1030
|
+
11. ModelStorage
|
|
1031
|
+
Purpose: SQLite-based persistence for models, attention weights, node memories, and agent data. Handles serialization/deserialization of numpy arrays and model dictionaries.
|
|
1032
|
+
---
|
|
1033
|
+
12. AgentDistributedInference
|
|
1034
|
+
Purpose: The distributed agent system - can act as a server or client, handles SSL/TLS security, rate limiting, authentication, peer-to-peer prediction requests, memory synchronization, ensemble voting, and trust management between agents.
|
|
1035
|
+
---
|
|
1036
|
+
14. QueryNode
|
|
1037
|
+
Purpose: Manages trust relationships and identity verification between nodes. Evaluates node agreement, establishes connections, performs safety checks, and maintains the network of trusted peers.
|
|
1038
|
+
---
|
|
1039
|
+
14. AutoBatcherAutomation
|
|
1040
|
+
Purpose: Automatically batches incoming prediction requests to optimize throughput. Collects requests up to a maximum batch size or time window, then processes them together.
|
|
1041
|
+
---
|
|
1042
|
+
15. IntegratedPipeline
|
|
1043
|
+
Purpose: The main orchestration class that ties everything together - handles text encoding, model initialization, training, prediction, memory management, hybrid predictions, and distributed inference coordination.
|
|
1044
|
+
---
|
|
1045
|
+
16. PipelinePredictionManager
|
|
1046
|
+
Purpose: High-level prediction interface that loads labels from CSV, performs regular/advanced/hybrid predictions, displays results, and calculates entropy for uncertainty estimation.
|
|
1047
|
+
---
|
|
1048
|
+
17. ThreadedMessageQueue
|
|
1049
|
+
purpose: Handles message queue in thread for asynchronous message handling. (Queue based)
|
|
1050
|
+
---
|
|
1051
|
+
18. AsyncMessageQueue
|
|
1052
|
+
purpose: Handles incoming message from Asychronous peer request (Queue based)
|
|
1053
|
+
---
|
|
1054
|
+
19. CohesiveAgentDeployment
|
|
1055
|
+
purpose: Handles both synchronous prediction, and P2P Asynchronous prediction request, acts as a server and a listener simultaneously.
|
|
1056
|
+
---
|
|
1057
|
+
20. ConsecutivePeerAgent
|
|
1058
|
+
purpose: handles ensemble weighting from received output from peer, managed server and acts as a listener simultaneously.
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
## Full Documentation Features
|
|
1062
|
+
- [Go to IntegratedPipeline-Specialized-AI-Agent-library](#IntegratedPipeline-Specialized-AI-Agent-library)
|
|
1063
|
+
- [Go to MANN Intro](#MANN-Intro)
|
|
1064
|
+
- [Go to Abstract Weight Encoder (AWE) Intro](#Abstract-Weight-Encoder-(AWE)-Intro)
|
|
1065
|
+
- [Go to Why IntegratedPipeline?](#Why-IntegratedPipeline?)
|
|
1066
|
+
- [Go to Requirements](#Requirements)
|
|
1067
|
+
- [Go to System-Specific-Notes](#System-Specific-Notes)
|
|
1068
|
+
- [Go to Quickstart with Docker](#Quickstart-with-Docker)
|
|
1069
|
+
- [Go to Performance in ARM64 Environment/Container](#Performance-in-ARM64-Environment/Container)
|
|
1070
|
+
- [Go to Step's for in-depth Usage](#Step's-for-in-depth-Usage)
|
|
1071
|
+
- [Go to Troubleshooting](#Troubleshooting)
|
|
1072
|
+
- [Go to Detailed process of Alpha-computing](#Detailed-process-of-Alpha-computing)
|
|
1073
|
+
- [Go to Main Components](#Components)
|
|
1074
|
+
- [Go to Source code](#Source-code-of-AbstractIntegratedModule)
|
|
1075
|
+
- Consider checking:
|
|
1076
|
+
- [ROADMAP.md](ROADMAP.md)
|
|
1077
|
+
- [Contributing.md](Contributing.md)
|
|
1078
|
+
- [changelog.md](changelog.md)
|
|
1079
|
+
- [requirements-dev.txt](requirements-dev.txt) for contributors requirements.
|
|
1080
|
+
- [architecture_diagram.js](architecture_diagram.js).
|
|
1081
|
+
|
|
1082
|
+
## License
|
|
1083
|
+
[=] LICENSE: - MIT (2026) || See [LICENSE](LICENSE) for more information.
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|