AbstractIntegratedModule 0.3.5__tar.gz → 0.3.6__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.
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6/AbstractIntegratedModule.egg-info}/PKG-INFO +2 -2
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.py +54 -51
- {abstractintegratedmodule-0.3.5/AbstractIntegratedModule.egg-info → abstractintegratedmodule-0.3.6}/PKG-INFO +2 -2
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/README.md +1 -1
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/setup.py +1 -1
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.cp313-win_amd64.pyd +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.cpython-310-aarch64-linux-gnu.so +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.cpython-312-x86_64-linux-gnu.so +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.egg-info/SOURCES.txt +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.egg-info/dependency_links.txt +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.egg-info/requires.txt +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.egg-info/top_level.txt +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/MANIFEST.in +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/pyproject.toml +0 -0
- {abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AbstractIntegratedModule
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: Framework for Advanced Integrated Non-LLM AI Module library - Backend Framework for Non-LLM AI Agent Framework
|
|
5
5
|
Author: Micro-Novelty
|
|
6
6
|
Author-email: hernikpuspita5@gmail.com
|
|
@@ -42,7 +42,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
42
42
|
#### 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.
|
|
43
43
|
|
|
44
44
|
### Library Short Description:
|
|
45
|
-
- Development Stage: Beta, 0.3.
|
|
45
|
+
- Development Stage: Beta, 0.3.6.
|
|
46
46
|
- Maintainer: Micro-Novelty.
|
|
47
47
|
- library Source-Code is Open-sourced on github.
|
|
48
48
|
- Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
|
{abstractintegratedmodule-0.3.5 → abstractintegratedmodule-0.3.6}/AbstractIntegratedModule.py
RENAMED
|
@@ -45,9 +45,6 @@ from sklearn.preprocessing import StandardScaler
|
|
|
45
45
|
# initial Setup logging for AgentDistributedInference and ModelStorage class logger and security logger
|
|
46
46
|
logger = logging.getLogger(__name__)
|
|
47
47
|
_integrated_pipeline_lock = threading.Lock()
|
|
48
|
-
# thread lock for P2P safety to prevent conflicting instances
|
|
49
|
-
_agent_inference_lock = threading.Lock()
|
|
50
|
-
_integrated_pipeline_lock = threading.Lock()
|
|
51
48
|
|
|
52
49
|
class MessagePriority(Enum):
|
|
53
50
|
LOW = 0
|
|
@@ -306,21 +303,22 @@ class GeometricWeightShaping:
|
|
|
306
303
|
|
|
307
304
|
def eigenvalue_encoder(self, x):
|
|
308
305
|
eps = 1e-5
|
|
309
|
-
|
|
310
|
-
if
|
|
311
|
-
|
|
306
|
+
raw_X = np.asarray(x)
|
|
307
|
+
if raw_X.ndim > 2:
|
|
308
|
+
raw_X = raw_X.reshape(raw_X.shape[0], -1)
|
|
312
309
|
|
|
313
|
-
mag = np.mean(np.linalg.norm(
|
|
310
|
+
mag = np.mean(np.linalg.norm(raw_X, axis=-1))
|
|
311
|
+
if np.isnan(mag) or np.isinf(mag):
|
|
312
|
+
mag = self.AME_Encoder(raw_X)
|
|
314
313
|
|
|
315
|
-
anisotropy = self.anisotropy_measurement(
|
|
314
|
+
anisotropy = self.anisotropy_measurement(raw_X)
|
|
316
315
|
|
|
317
|
-
structured_noise = np.random.uniform(0, mag, size=
|
|
318
|
-
X = np.vstack((
|
|
319
|
-
if X.ndim
|
|
320
|
-
X =
|
|
316
|
+
structured_noise = np.random.uniform(0, mag, size=raw_X.shape)
|
|
317
|
+
X = np.vstack((raw_X, structured_noise))
|
|
318
|
+
if X.ndim == 2 and X.shape[1] == 1:
|
|
319
|
+
X = np.hstack((raw_X, structured_noise))
|
|
321
320
|
|
|
322
321
|
cov = np.cov(X, rowvar=False)
|
|
323
|
-
|
|
324
322
|
eigenvalues, eigenvectors = np.linalg.eigh(cov)
|
|
325
323
|
idx = np.argsort(eigenvalues)[::-1]
|
|
326
324
|
|
|
@@ -334,22 +332,30 @@ class GeometricWeightShaping:
|
|
|
334
332
|
trA = k / (1.0 - anisotropy) + eps
|
|
335
333
|
trB = (1/2 + mag_G) / (1.0 + trA**2)
|
|
336
334
|
trC = (1/6 + K_G) / (trB**2 - 1.0)
|
|
337
|
-
return trC, k
|
|
338
335
|
|
|
336
|
+
floating_point = np.random.uniform(0, trC, size=X.shape)
|
|
337
|
+
return trC, k, floating_point, structured_noise
|
|
339
338
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
339
|
+
|
|
340
|
+
def spectral_signature(self, x, structured_noise, k=5):
|
|
341
|
+
raw_X = np.asarray(x)
|
|
342
|
+
if raw_X.ndim > 2:
|
|
343
|
+
X = raw_X.reshape(raw_X.shape[0], -1)
|
|
344
|
+
else:
|
|
345
|
+
X = raw_X.reshape(raw_X.shape[0], -1)
|
|
346
|
+
|
|
347
|
+
X = np.atleast_2d(X)
|
|
348
|
+
if X.ndim == 2 and X.shape[1] == 1:
|
|
349
|
+
X = np.hstack((X, structured_noise))
|
|
350
|
+
|
|
351
|
+
cov= np.cov(X, rowvar=False, ddof=1)
|
|
346
352
|
eigvals = np.linalg.eigvalsh(cov)
|
|
347
353
|
eigvals = np.sort(eigvals)[::-1]
|
|
348
354
|
return eigvals[:k] / (eigvals.sum() + 1e-8)
|
|
349
355
|
|
|
350
|
-
def spectral_similarity(self, a, b):
|
|
351
|
-
sa = self.spectral_signature(a)
|
|
352
|
-
sb = self.spectral_signature(b)
|
|
356
|
+
def spectral_similarity(self, a, b, structured_noise):
|
|
357
|
+
sa = self.spectral_signature(a, structured_noise)
|
|
358
|
+
sb = self.spectral_signature(b, structured_noise)
|
|
353
359
|
return np.exp(-np.linalg.norm(sa - sb))
|
|
354
360
|
|
|
355
361
|
# abstract modelling error provides the model how to better process weights when the data complexity has little geometric complexity
|
|
@@ -386,23 +392,29 @@ class GeometricWeightShaping:
|
|
|
386
392
|
def abstract_weight_shaping(self, x):
|
|
387
393
|
input_size = self.input_size
|
|
388
394
|
output_size = self.output_size
|
|
395
|
+
eps = 1e-5
|
|
396
|
+
x = np.asarray(x)
|
|
389
397
|
|
|
390
398
|
rng = np.random.default_rng()
|
|
391
399
|
|
|
392
400
|
anisotropy = self.anisotropy_measurement(x)
|
|
393
401
|
mag = np.mean(np.linalg.norm(x))
|
|
394
402
|
|
|
395
|
-
trC, k = self.eigenvalue_encoder(x)
|
|
403
|
+
trC, k, floating_point, structured_noise = self.eigenvalue_encoder(x)
|
|
396
404
|
AME = self.AME_Encoder(x)
|
|
405
|
+
AMR = 1.0 / (1.0 + np.exp(-AME)) # abstract modelling rate
|
|
406
|
+
if np.isnan(trC) or np.isinf(trC):
|
|
407
|
+
trC = (1.0 - AMR) + eps
|
|
397
408
|
|
|
398
|
-
|
|
399
|
-
spectral_similarity = self.spectral_similarity(x, floating_point)
|
|
409
|
+
spectral_similarity = self.spectral_similarity(x, floating_point, structured_noise)
|
|
400
410
|
|
|
401
|
-
AEL = 0.3 + spectral_similarity * anisotropy
|
|
411
|
+
AEL = (0.3 + spectral_similarity + eps) * anisotropy
|
|
402
412
|
scaled_anisotropy = anisotropy / (anisotropy + 1.0)
|
|
403
|
-
AMR = 1.0 / (1.0 + np.exp(-AME)) # abstract modelling rate
|
|
404
413
|
|
|
405
414
|
efficient_distributed_energy = k + AEL * (1.0 - AMR)
|
|
415
|
+
if np.isnan(efficient_distributed_energy) or np.isinf(efficient_distributed_energy):
|
|
416
|
+
efficient_distributed_energy = (1 - AMR) + eps
|
|
417
|
+
|
|
406
418
|
floating_context = rng.uniform(0, efficient_distributed_energy, size=(input_size, output_size))
|
|
407
419
|
self.floating_context = floating_context
|
|
408
420
|
|
|
@@ -425,6 +437,7 @@ class GeometricWeightShaping:
|
|
|
425
437
|
return floating_context
|
|
426
438
|
|
|
427
439
|
|
|
440
|
+
|
|
428
441
|
# ________ UTILITY functions for activations and losses, can be used across different models and architectures _________
|
|
429
442
|
|
|
430
443
|
def sigmoid(x):
|
|
@@ -1805,14 +1818,15 @@ class LSTMEngine:
|
|
|
1805
1818
|
preds, _, _, _ = model.forward(X_te[j])
|
|
1806
1819
|
if preds.shape != Y_te.shape:
|
|
1807
1820
|
if preds.shape[0] > Y_te.shape[0]:
|
|
1808
|
-
Y_te = Y_te[:preds.shape[0], :
|
|
1821
|
+
Y_te = Y_te[:preds.shape[0], :]
|
|
1809
1822
|
if Y_te.shape[0] > preds.shape[0]:
|
|
1810
|
-
preds = preds[:Y_te.shape[0], :
|
|
1823
|
+
preds = preds[:Y_te.shape[0], :]
|
|
1811
1824
|
else:
|
|
1812
1825
|
preds = preds[:Y_te.shape[0], :Y_te.shape[1]]
|
|
1813
1826
|
|
|
1814
1827
|
Y_te = Y_te[:preds.shape[0], :preds.shape[1]]
|
|
1815
|
-
preds = preds[:Y_te.shape[0], :Y_te.shape[1]]
|
|
1828
|
+
preds = preds[:Y_te.shape[0], :Y_te.shape[1]]
|
|
1829
|
+
|
|
1816
1830
|
val_loss += AMR * np.mean((preds - Y_te[j]) ** 2)
|
|
1817
1831
|
val_loss /= len(X_te)
|
|
1818
1832
|
print(f"[=] Epoch {epoch:>4}/{epochs} "
|
|
@@ -4761,6 +4775,7 @@ class ThreadedMessageQueue:
|
|
|
4761
4775
|
class AgentDistributedInference:
|
|
4762
4776
|
def __init__(self, pipeline, storage, memory_name, port=5555, use_async=False, secret_key=None, ssl_cert_file=None, ssl_key_file=None, shared_auth_token=None, predict_manager=None):
|
|
4763
4777
|
# Stored initialization params for debugging later
|
|
4778
|
+
|
|
4764
4779
|
self.pipeline = pipeline
|
|
4765
4780
|
self.memory_name = memory_name
|
|
4766
4781
|
self.port = port
|
|
@@ -4900,9 +4915,12 @@ class AgentDistributedInference:
|
|
|
4900
4915
|
def _setup_ssl(self):
|
|
4901
4916
|
# Setup SSL context for encrypted connections
|
|
4902
4917
|
try:
|
|
4903
|
-
self.ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
|
4918
|
+
self.ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
|
4919
|
+
self.ssl_context.verify_mode = ssl.CERT_REQUIRED
|
|
4920
|
+
self.ssl_context.check_hostname = True
|
|
4904
4921
|
if self.ssl_cert_file and self.ssl_key_file:
|
|
4905
4922
|
self.ssl_context.load_cert_chain(self.ssl_cert_file, self.ssl_key_file)
|
|
4923
|
+
self.ssl_context.verify_mode = ssl.CERT_REQUIRED
|
|
4906
4924
|
else:
|
|
4907
4925
|
# Generate self-signed certificate for first layer security
|
|
4908
4926
|
self._generate_self_signed_cert()
|
|
@@ -4961,7 +4979,6 @@ class AgentDistributedInference:
|
|
|
4961
4979
|
self.ssl_key_file = 'server.key'
|
|
4962
4980
|
self.ssl_context.load_cert_chain(self.ssl_cert_file, self.ssl_key_file)
|
|
4963
4981
|
|
|
4964
|
-
|
|
4965
4982
|
def _generate_auth_token(self):
|
|
4966
4983
|
return hashlib.sha256(os.urandom(32)).hexdigest()
|
|
4967
4984
|
|
|
@@ -5176,9 +5193,6 @@ class AgentDistributedInference:
|
|
|
5176
5193
|
self.running = True
|
|
5177
5194
|
logger.info(f"[=] Server started on port {self.port} with SSL={'enabled' if self.enable_ssl else 'disabled'}")
|
|
5178
5195
|
|
|
5179
|
-
if self.enable_ssl and self.ssl_context:
|
|
5180
|
-
self.socket = self.ssl_context.wrap_socket(self.socket, server_side=True)
|
|
5181
|
-
|
|
5182
5196
|
print(f"[🤖] Agent listening on port {self.port}")
|
|
5183
5197
|
|
|
5184
5198
|
# Start accepting connections in background
|
|
@@ -6876,7 +6890,7 @@ class IntegratedPipeline:
|
|
|
6876
6890
|
def __init__(self, memory_name='agent_memory', use_async=False, agent_port=None, ssl_cert_file=None, ssl_key_file=None, secret_key=None, shared_auth_token=None, predict_manager=None):
|
|
6877
6891
|
# Only initialized once and when allowed
|
|
6878
6892
|
|
|
6879
|
-
print('[= MEMORY =] Initializing IntegratedPipeline with memory name:', memory_name)
|
|
6893
|
+
print('[= MEMORY =] Initializing IntegratedPipeline with memory name:', memory_name)
|
|
6880
6894
|
with _integrated_pipeline_lock:
|
|
6881
6895
|
super().__init__()
|
|
6882
6896
|
|
|
@@ -6893,7 +6907,7 @@ class IntegratedPipeline:
|
|
|
6893
6907
|
'ssl_key_file': ssl_key_file,
|
|
6894
6908
|
'shared_auth_token': shared_auth_token
|
|
6895
6909
|
|
|
6896
|
-
}
|
|
6910
|
+
}
|
|
6897
6911
|
|
|
6898
6912
|
self.ssl_cert_file = ssl_cert_file
|
|
6899
6913
|
self.ssl_key_file = ssl_key_file
|
|
@@ -12343,8 +12357,6 @@ class ConsecutivePeerAgent:
|
|
|
12343
12357
|
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
12344
12358
|
self.server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
12345
12359
|
self.server_socket.bind(('0.0.0.0', self.port))
|
|
12346
|
-
if self.pipeline.distribution.enable_ssl and self.pipeline.distribution.ssl_context:
|
|
12347
|
-
self.server_socket = self.pipeline.distribution.ssl_context.wrap_socket(self.server_socket, server_side=True)
|
|
12348
12360
|
|
|
12349
12361
|
self.server_socket.listen(5)
|
|
12350
12362
|
self.running = True
|
|
@@ -12494,7 +12506,6 @@ class CohesiveAgentDeployment:
|
|
|
12494
12506
|
label=label_name
|
|
12495
12507
|
)
|
|
12496
12508
|
|
|
12497
|
-
|
|
12498
12509
|
self._peer_agent = ConsecutivePeerAgent(
|
|
12499
12510
|
peer_id=self.pipeline.memory_name,
|
|
12500
12511
|
port=peer_discovery_port + 100,
|
|
@@ -12735,11 +12746,7 @@ class CohesiveAgentDeployment:
|
|
|
12735
12746
|
while not self._shutdown_event.is_set() and self.discovery:
|
|
12736
12747
|
try:
|
|
12737
12748
|
# UDP broadcast socket
|
|
12738
|
-
|
|
12739
|
-
sock = self.pipeline.distribution.ssl_context.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_DGRAM))
|
|
12740
|
-
else:
|
|
12741
|
-
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
12742
|
-
|
|
12749
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
12743
12750
|
print(f"[broadcast_discovery() SOCKET CREATED] id={id(sock)}")
|
|
12744
12751
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
|
12745
12752
|
sock.settimeout(2)
|
|
@@ -13205,11 +13212,7 @@ class CohesiveAgentDeployment:
|
|
|
13205
13212
|
|
|
13206
13213
|
def _is_server_listening(self) -> bool:
|
|
13207
13214
|
# if the server is actually listening on its port
|
|
13208
|
-
|
|
13209
|
-
sock = self.pipeline.distribution.ssl_context.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
|
|
13210
|
-
else:
|
|
13211
|
-
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
13212
|
-
|
|
13215
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
13213
13216
|
sock.settimeout(1)
|
|
13214
13217
|
try:
|
|
13215
13218
|
result = sock.connect_ex(('127.0.0.1', self.peer_discovery_port))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AbstractIntegratedModule
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: Framework for Advanced Integrated Non-LLM AI Module library - Backend Framework for Non-LLM AI Agent Framework
|
|
5
5
|
Author: Micro-Novelty
|
|
6
6
|
Author-email: hernikpuspita5@gmail.com
|
|
@@ -42,7 +42,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
42
42
|
#### 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.
|
|
43
43
|
|
|
44
44
|
### Library Short Description:
|
|
45
|
-
- Development Stage: Beta, 0.3.
|
|
45
|
+
- Development Stage: Beta, 0.3.6.
|
|
46
46
|
- Maintainer: Micro-Novelty.
|
|
47
47
|
- library Source-Code is Open-sourced on github.
|
|
48
48
|
- Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
|
|
@@ -10,7 +10,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
|
|
|
10
10
|
#### 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.
|
|
11
11
|
|
|
12
12
|
### Library Short Description:
|
|
13
|
-
- Development Stage: Beta, 0.3.
|
|
13
|
+
- Development Stage: Beta, 0.3.6.
|
|
14
14
|
- Maintainer: Micro-Novelty.
|
|
15
15
|
- library Source-Code is Open-sourced on github.
|
|
16
16
|
- Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
|
|
@@ -8,7 +8,7 @@ class BinaryDistribution(Distribution):
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="AbstractIntegratedModule",
|
|
11
|
-
version="0.3.
|
|
11
|
+
version="0.3.6",
|
|
12
12
|
description="Framework for Advanced Integrated Non-LLM AI Module library - Backend Framework for Non-LLM AI Agent Framework",
|
|
13
13
|
long_description=open("README.md", encoding="utf-8").read(),
|
|
14
14
|
long_description_content_type="text/markdown",
|
|
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
|