AbstractIntegratedModule 0.9.9__tar.gz → 1.0.0__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.9.9 → abstractintegratedmodule-1.0.0}/AbstractIntegratedModule.egg-info/PKG-INFO +2 -2
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/AbstractIntegratedModule.py +91 -47
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/AbstractOptimizedModules.c +200 -200
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/PKG-INFO +2 -2
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/README.md +1 -1
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/setup.py +1 -1
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/AbstractIntegratedModule.egg-info/SOURCES.txt +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/AbstractIntegratedModule.egg-info/dependency_links.txt +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/AbstractIntegratedModule.egg-info/requires.txt +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/AbstractIntegratedModule.egg-info/top_level.txt +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/AbstractOptimizedModules.pyx +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/MANIFEST.in +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/Cargo.toml +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/pyproject.toml +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/src/lib.rs +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/target/debug/build/libsqlite3-sys-ed07b882cd2aa5e2/out/bindgen.rs +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/target/debug/build/serde_core-ebc15f2e9cad7f5f/out/private.rs +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/target/debug/build/target-lexicon-08527f45de28143d/out/host.rs +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/target/release/build/libsqlite3-sys-bf0400df4523274c/out/bindgen.rs +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/target/release/build/serde_core-5cdb76131825e4af/out/private.rs +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/abstract_model_storage/target/release/build/target-lexicon-43eb95a0588bf457/out/host.rs +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/pyproject.toml +0 -0
- {abstractintegratedmodule-0.9.9 → abstractintegratedmodule-1.0.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AbstractIntegratedModule
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Library for Advanced Integrated Non-LLM AI Models - Optimized Backend Framework For Non-LLM AI Agent
|
|
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: 0.
|
|
45
|
+
- Development Stage: 1.0.0 Official Release.
|
|
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.9.9 → abstractintegratedmodule-1.0.0}/AbstractIntegratedModule.py
RENAMED
|
@@ -1937,6 +1937,10 @@ class MLP:
|
|
|
1937
1937
|
n_classes = len(label_map)
|
|
1938
1938
|
|
|
1939
1939
|
self.pred_counts = self.pred_counts[0] if isinstance(self.pred_counts[0], np.ndarray) and self.pred_counts.ndim > 1 else self.pred_counts
|
|
1940
|
+
if len(self.pred_counts) != n_classes:
|
|
1941
|
+
self.pred_counts = np.zeros(n_classes, dtype=np.float64)
|
|
1942
|
+
self.pred_counts[predicted_index] += 1.0
|
|
1943
|
+
self.pred_counts = self.pred_counts[0] if isinstance(self.pred_counts[0], np.ndarray) and self.pred_counts.ndim > 1 else self.pred_counts
|
|
1940
1944
|
|
|
1941
1945
|
for c in range(n_classes):
|
|
1942
1946
|
if len(self.pred_counts) < c:
|
|
@@ -1947,19 +1951,12 @@ class MLP:
|
|
|
1947
1951
|
# error_rate=0.5 → multiplier≈0.67
|
|
1948
1952
|
# error_rate=1.0 → multiplier≈0.5
|
|
1949
1953
|
reputation = 1.0 / (1.0 + error_rate)
|
|
1950
|
-
if
|
|
1951
|
-
prob
|
|
1952
|
-
|
|
1953
|
-
self.pred_counts = np.zeros(n_classes, dtype=np.float64)
|
|
1954
|
-
self.pred_counts[predicted_index] += 1.0
|
|
1955
|
-
self.pred_counts = self.pred_counts[0] if isinstance(self.pred_counts[0], np.ndarray) and self.pred_counts.ndim > 1 else self.pred_counts
|
|
1954
|
+
if isinstance(error_rate, (list, np.ndarray)):
|
|
1955
|
+
if len(error_rate) != len(prob):
|
|
1956
|
+
reputation = 1.0 / (1.0 + np.mean(error_rate))
|
|
1956
1957
|
|
|
1957
|
-
if isinstance(self.pred_counts[c], (int, float)) and self.pred_counts[c] > 0:
|
|
1958
|
-
error_rate = self.error_counts[c] / (self.pred_counts[c] + 1e-8)
|
|
1959
|
-
|
|
1960
|
-
reputation = 1.0 / (1.0 + error_rate)
|
|
1961
1958
|
if c < len(prob):
|
|
1962
|
-
prob[c] *= reputation
|
|
1959
|
+
prob[c] *= reputation
|
|
1963
1960
|
|
|
1964
1961
|
prob_sum = prob.sum()
|
|
1965
1962
|
if prob_sum > 1e-8:
|
|
@@ -5987,7 +5984,7 @@ class ModelStorage:
|
|
|
5987
5984
|
|
|
5988
5985
|
elif type == 'Accurate-Cache':
|
|
5989
5986
|
c = conn.cursor()
|
|
5990
|
-
|
|
5987
|
+
|
|
5991
5988
|
c.execute("""
|
|
5992
5989
|
SELECT 1 FROM accurate_cache_storage
|
|
5993
5990
|
WHERE memory_name = ? and is_active = 1
|
|
@@ -15568,6 +15565,9 @@ class PipelinePredictionManager:
|
|
|
15568
15565
|
if self.pipeline.cache and 'label_bins' in self.pipeline.cache:
|
|
15569
15566
|
print('[=] label_bins cache found!')
|
|
15570
15567
|
label_bins = self.pipeline.cache['label_bins']
|
|
15568
|
+
if X_gen is None:
|
|
15569
|
+
X_gen = X
|
|
15570
|
+
|
|
15571
15571
|
lstm_probs, _ = self.pipeline.ensemble._get_lstm_probs(input_ids, X_gen, label_bins=label_bins)
|
|
15572
15572
|
else:
|
|
15573
15573
|
lstm_probs = None
|
|
@@ -16173,21 +16173,38 @@ class PipelinePredictionManager:
|
|
|
16173
16173
|
is_valid_index = 0 <= mlp_class_idx < num_classes
|
|
16174
16174
|
|
|
16175
16175
|
if not is_valid_index:
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16176
|
+
try:
|
|
16177
|
+
mlp_class_idx = int(np.argmax(mlp_probs[:len(reverse_map)-1]))
|
|
16178
|
+
mlp_confidence = float(mlp_probs[:len(reverse_map)-1][mlp_class_idx])
|
|
16179
|
+
mlp_label = reverse_map.get(mlp_class_idx, f"unknown_{mlp_class_idx}")
|
|
16180
|
+
return {
|
|
16181
|
+
'predicted' : mlp_label,
|
|
16182
|
+
'confidence' : mlp_confidence,
|
|
16183
|
+
'mlp_class' : mlp_class_idx,
|
|
16184
|
+
'index' : mlp_class_idx,
|
|
16185
|
+
'models_agree': models_agree,
|
|
16186
|
+
'final_probs' : mlp_probs[:len(reverse_map)-1],
|
|
16187
|
+
'is_valid' : True,
|
|
16188
|
+
}
|
|
16189
|
+
except:
|
|
16190
|
+
return {
|
|
16191
|
+
'predicted' : None,
|
|
16192
|
+
'confidence' : 0.0,
|
|
16193
|
+
'mlp_class' : 0,
|
|
16194
|
+
'index' : 0,
|
|
16195
|
+
'models_agree': False,
|
|
16196
|
+
'final_probs' : mlp_probs,
|
|
16197
|
+
'is_valid' : False,
|
|
16198
|
+
'error' : f'class_index_out_of_range(idx={mlp_class_idx}, num_classes={num_classes})'
|
|
16199
|
+
}
|
|
16200
|
+
|
|
16201
|
+
mlp_confidence = float(mlp_probs[i][mlp_class_idx])
|
|
16185
16202
|
mlp_label = reverse_map.get(mlp_class_idx, f"unknown_{mlp_class_idx}")
|
|
16186
16203
|
|
|
16187
16204
|
# ── LSTM ────────────────────────────────────────────
|
|
16188
16205
|
# lstm_pred_indices passed in precomputed, not recomputed per-sample
|
|
16189
16206
|
if lstm_probs is not None and lstm_pred_indices is not None:
|
|
16190
|
-
lstm_class_idx = int(lstm_pred_indices[i])
|
|
16207
|
+
lstm_class_idx = int(lstm_pred_indices[i])
|
|
16191
16208
|
lstm_confidence = float(lstm_probs[i][lstm_class_idx])
|
|
16192
16209
|
else:
|
|
16193
16210
|
# explicit default so lstm_class_idx is always defined, even if LSTM is not used
|
|
@@ -16304,7 +16321,7 @@ class PipelinePredictionManager:
|
|
|
16304
16321
|
return {
|
|
16305
16322
|
'is_valid' : True,
|
|
16306
16323
|
'predicted' : reverse_map.get(final_class_idx, f"unknown_{final_class_idx}"),
|
|
16307
|
-
'
|
|
16324
|
+
'index' : final_class_idx,
|
|
16308
16325
|
'confidence' : float(final_confidence),
|
|
16309
16326
|
'mlp_class' : mlp_class_idx,
|
|
16310
16327
|
'mlp_prediction' : mlp_label,
|
|
@@ -16797,9 +16814,37 @@ class PipelinePredictionManager:
|
|
|
16797
16814
|
verbose = False
|
|
16798
16815
|
if float(results[0]['confidence']) < self.pipeline.confidence_threshold:
|
|
16799
16816
|
verbose = True
|
|
16800
|
-
|
|
16801
|
-
chosen_label = results[0]
|
|
16802
|
-
confidence = results[0]
|
|
16817
|
+
|
|
16818
|
+
chosen_label = results[0].get('predicted') if results else None
|
|
16819
|
+
confidence = results[0].get('confidence') if results else 0.0
|
|
16820
|
+
if chosen_label is None:
|
|
16821
|
+
for i in range(num_classes):
|
|
16822
|
+
mlp_class_idx = int(mlp_pred_indices[i])
|
|
16823
|
+
is_valid_index = 0 <= mlp_class_idx < num_classes
|
|
16824
|
+
|
|
16825
|
+
if mlp_class_idx > len(reverse_map) or not is_valid_index:
|
|
16826
|
+
mlp_class_idx = int(np.argmax(mlp_probs[:len(reverse_map)-1]))
|
|
16827
|
+
print(f"[⚠️] Clamping index {mlp_class_idx} → {mlp_class_idx}")
|
|
16828
|
+
|
|
16829
|
+
if is_valid_index:
|
|
16830
|
+
mlp_confidence = float(mlp_probs[i][mlp_class_idx])
|
|
16831
|
+
else:
|
|
16832
|
+
mlp_confidence = float(mlp_probs[:len(reverse_map)-1][mlp_class_idx])
|
|
16833
|
+
|
|
16834
|
+
mlp_label = reverse_map.get(mlp_class_idx, f"unknown_{mlp_class_idx}")
|
|
16835
|
+
results.append({
|
|
16836
|
+
'predicted' : mlp_label,
|
|
16837
|
+
'confidence' : mlp_confidence,
|
|
16838
|
+
'mlp_class' : mlp_class_idx,
|
|
16839
|
+
'index' : mlp_class_idx,
|
|
16840
|
+
'models_agree': False,
|
|
16841
|
+
'final_probs' : mlp_probs,
|
|
16842
|
+
'is_valid' : True,
|
|
16843
|
+
})
|
|
16844
|
+
|
|
16845
|
+
chosen_label = results[0].get('predicted') if results else None
|
|
16846
|
+
confidence = results[0].get('confidence') if results else None
|
|
16847
|
+
|
|
16803
16848
|
if isinstance(chosen_label, int) or isinstance(chosen_label, np.integer):
|
|
16804
16849
|
chosen_label = str(chosen_label)
|
|
16805
16850
|
|
|
@@ -16830,6 +16875,9 @@ class PipelinePredictionManager:
|
|
|
16830
16875
|
final_idx = int(final_idx)
|
|
16831
16876
|
|
|
16832
16877
|
chosen_label = reverse_map.get(final_idx, f"unknown_{final_idx}")
|
|
16878
|
+
if chosen_label.startswith('unknown'):
|
|
16879
|
+
final_idx = int(np.argmax(final_probs[:len(reverse_map)-1]))
|
|
16880
|
+
|
|
16833
16881
|
try:
|
|
16834
16882
|
print(final_probs)
|
|
16835
16883
|
confidence = float(final_probs[final_idx])
|
|
@@ -17115,6 +17163,11 @@ class PipelinePredictionManager:
|
|
|
17115
17163
|
|
|
17116
17164
|
self.pred_counts = self.pred_counts[0] if isinstance(self.pred_counts[0], np.ndarray) and self.pred_counts.ndim > 1 else self.pred_counts
|
|
17117
17165
|
|
|
17166
|
+
if len(self.pred_counts) != n_classes:
|
|
17167
|
+
self.pred_counts = np.zeros(n_classes, dtype=np.float64)
|
|
17168
|
+
self.pred_counts[predicted_index] += 1.0
|
|
17169
|
+
self.pred_counts = self.pred_counts[0] if isinstance(self.pred_counts[0], np.ndarray) and self.pred_counts.ndim > 1 else self.pred_counts
|
|
17170
|
+
|
|
17118
17171
|
for c in range(n_classes):
|
|
17119
17172
|
if len(self.pred_counts) < c:
|
|
17120
17173
|
if isinstance(self.pred_counts[c], (int, float)) and self.pred_counts[c] > 0:
|
|
@@ -17124,24 +17177,13 @@ class PipelinePredictionManager:
|
|
|
17124
17177
|
# error_rate=0.5 → multiplier≈0.67
|
|
17125
17178
|
# error_rate=1.0 → multiplier≈0.5
|
|
17126
17179
|
reputation = 1.0 / (1.0 + error_rate)
|
|
17127
|
-
if
|
|
17128
|
-
final_probs
|
|
17129
|
-
|
|
17130
|
-
self.pred_counts = np.zeros(n_classes, dtype=np.float64)
|
|
17131
|
-
self.pred_counts[predicted_index] += 1.0
|
|
17132
|
-
self.pred_counts = self.pred_counts[0] if isinstance(self.pred_counts[0], np.ndarray) and self.pred_counts.ndim > 1 else self.pred_counts
|
|
17180
|
+
if isinstance(error_rate, (list, np.ndarray)):
|
|
17181
|
+
if len(error_rate) != len(final_probs):
|
|
17182
|
+
reputation = 1.0 / (1.0 + np.mean(error_rate))
|
|
17133
17183
|
|
|
17134
|
-
if isinstance(self.pred_counts[c], (int, float)) and self.pred_counts[c] > 0:
|
|
17135
|
-
error_rate = self.error_counts[c] / (self.pred_counts[c] + 1e-8)
|
|
17136
|
-
# sigmoid-shaped dampening — never goes negative
|
|
17137
|
-
# error_rate=0.0 → multiplier=1.0 (no change)
|
|
17138
|
-
# error_rate=0.5 → multiplier≈0.67
|
|
17139
|
-
# error_rate=1.0 → multiplier≈0.5
|
|
17140
|
-
reputation = 1.0 / (1.0 + error_rate)
|
|
17141
17184
|
if c < len(final_probs):
|
|
17142
|
-
final_probs[c] *= reputation
|
|
17143
|
-
|
|
17144
|
-
|
|
17185
|
+
final_probs[c] *= reputation
|
|
17186
|
+
|
|
17145
17187
|
prob_sum = final_probs.sum()
|
|
17146
17188
|
if prob_sum > 1e-8:
|
|
17147
17189
|
final_probs /= prob_sum
|
|
@@ -17166,6 +17208,7 @@ class PipelinePredictionManager:
|
|
|
17166
17208
|
|
|
17167
17209
|
correct = 0
|
|
17168
17210
|
sec_correct = 0
|
|
17211
|
+
error = 0
|
|
17169
17212
|
total_with_expected = 0
|
|
17170
17213
|
X_samples, input_ids = payload['X_samples'], payload['input_ids']
|
|
17171
17214
|
|
|
@@ -17189,8 +17232,9 @@ class PipelinePredictionManager:
|
|
|
17189
17232
|
|
|
17190
17233
|
sec_correct += 1
|
|
17191
17234
|
else:
|
|
17192
|
-
|
|
17193
|
-
|
|
17235
|
+
error += 1
|
|
17236
|
+
if isinstance(self.error_counts[result.get('index')], (int, float)):
|
|
17237
|
+
self.error_counts[result.get('index')] += 1.0
|
|
17194
17238
|
|
|
17195
17239
|
if result['predicted'] == result['expected']:
|
|
17196
17240
|
if result['sec_index'] is None:
|
|
@@ -17203,10 +17247,10 @@ class PipelinePredictionManager:
|
|
|
17203
17247
|
|
|
17204
17248
|
correct += 1
|
|
17205
17249
|
else:
|
|
17206
|
-
|
|
17207
|
-
|
|
17250
|
+
error += 1
|
|
17251
|
+
if isinstance(self.error_counts[result.get('index')], (int, float)):
|
|
17252
|
+
self.error_counts[result.get('index')] += 1.0
|
|
17208
17253
|
|
|
17209
|
-
|
|
17210
17254
|
# Agreement indicator
|
|
17211
17255
|
agree_symbol = "✓" if result.get('models_agree', True) else "⚠️"
|
|
17212
17256
|
print(f"[=] {agree_symbol} FINAL: {result['predicted']} ({result['confidence']:.1%})")
|