AbstractIntegratedModule 0.9.1__tar.gz → 0.9.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/AbstractIntegratedModule.egg-info/PKG-INFO +5 -7
  2. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/AbstractIntegratedModule.py +29 -45
  3. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/AbstractOptimizedModules.c +200 -200
  4. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/PKG-INFO +5 -7
  5. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/README.md +4 -6
  6. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/setup.py +1 -1
  7. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/AbstractIntegratedModule.egg-info/SOURCES.txt +0 -0
  8. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/AbstractIntegratedModule.egg-info/dependency_links.txt +0 -0
  9. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/AbstractIntegratedModule.egg-info/requires.txt +0 -0
  10. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/AbstractIntegratedModule.egg-info/top_level.txt +0 -0
  11. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/AbstractOptimizedModules.pyx +0 -0
  12. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/MANIFEST.in +0 -0
  13. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/Cargo.toml +0 -0
  14. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/pyproject.toml +0 -0
  15. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/src/lib.rs +0 -0
  16. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/target/debug/build/libsqlite3-sys-ed07b882cd2aa5e2/out/bindgen.rs +0 -0
  17. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/target/debug/build/serde_core-ebc15f2e9cad7f5f/out/private.rs +0 -0
  18. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/target/debug/build/target-lexicon-08527f45de28143d/out/host.rs +0 -0
  19. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/target/release/build/libsqlite3-sys-bf0400df4523274c/out/bindgen.rs +0 -0
  20. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/target/release/build/serde_core-5cdb76131825e4af/out/private.rs +0 -0
  21. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/abstract_model_storage/target/release/build/target-lexicon-43eb95a0588bf457/out/host.rs +0 -0
  22. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/pyproject.toml +0 -0
  23. {abstractintegratedmodule-0.9.1 → abstractintegratedmodule-0.9.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AbstractIntegratedModule
3
- Version: 0.9.1
3
+ Version: 0.9.2
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.9.1 Official Release.
45
+ - Development Stage: 0.9.2 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.
@@ -80,12 +80,10 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
80
80
  - Transformer Optimized using Cython, to reduce Memory overhead and Reduce CPU Usage, With Reduced Training Time.
81
81
  ______________
82
82
  - Changelog:
83
- - v0.9.1:
83
+ - v0.9.2:
84
84
  - [=] New features:
85
- - Ensemble method prediction is now secondary after conditions are met, and no longers acts as the Main prediction flow, Single pass (One Model) prediction now governs the Main prediction for long term stability and determinism in its learning capability.
86
- - Modifed advanced prediction to use single pass prediction as its main prediction method, ensemble prediction will be triggered when conditions are met.
87
- - Modifed advanced batch prediction to use single pass prediction for faster and more reliable prediction method.
88
- - added robustness for input ids handling.
85
+ - Replace ensemble fallback in advanced batch prediction with calibration method between Transformer and MLP models.
86
+ - fixed wrong argument type in hybrid prediction method in advanced prediction method.
89
87
 
90
88
  ____________
91
89
  <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" />
@@ -10152,6 +10152,7 @@ class IntegratedPipeline:
10152
10152
  """
10153
10153
  Process a single chunk - core batch logic with memory gate.
10154
10154
  """
10155
+ use_embedded = False
10155
10156
  chunk_probs = self._batch_model_memory_gate(chunk_ids, chunk_X)
10156
10157
 
10157
10158
  num_classes = self._get_num_classes()
@@ -10177,10 +10178,12 @@ class IntegratedPipeline:
10177
10178
  )
10178
10179
  else:
10179
10180
  fresh_probs = self.model3.forward(fresh_X)
10181
+
10180
10182
  try:
10181
- fresh_trans_probs, _ = self.model2.forward(fresh_input_ids, embedded=False)
10183
+ fresh_trans_probs, _ = self.model2.forward(fresh_ids, embedded=False)
10182
10184
  except:
10183
- fresh_trans_probs, _ = self.model2.forward(fresh_input_ids, embedded=True)
10185
+ use_embedded = True
10186
+ fresh_trans_probs, _ = self.model2.forward(fresh_ids, embedded=True)
10184
10187
 
10185
10188
  fresh_mlp_confidence = fresh_probs.max(axis=1, keepdims=True)
10186
10189
  fresh_trans_confidence = fresh_trans_probs.max(axis=1, keepdims=True)
@@ -10191,10 +10194,9 @@ class IntegratedPipeline:
10191
10194
  fresh_probs = fresh_trans_probs.copy()
10192
10195
 
10193
10196
  if np.std(fresh_probs) < 0.3 or np.mean(fresh_probs) < 0.3:
10194
- fresh_probs, _ = self.ensemble.predict_ensemble(
10197
+ fresh_probs = self.predict_proba(
10195
10198
  fresh_ids, fresh_X,
10196
- np.zeros((len(fresh_ids), num_classes)),
10197
- method='dynamic', embedded=False
10199
+ type='Hybrid', embedded=use_embedded
10198
10200
  )
10199
10201
 
10200
10202
 
@@ -10342,8 +10344,8 @@ class IntegratedPipeline:
10342
10344
 
10343
10345
  needs_prediction = [i for i, p in enumerate(batch_probs) if p is None]
10344
10346
  need_ensemble = (
10345
- len(chunk_ids) > 100 and
10346
- len(chunk_X) > 100
10347
+ len(batch_input_ids) > 100 and
10348
+ len(batch_X_raw) > 100
10347
10349
  )
10348
10350
 
10349
10351
  if needs_prediction:
@@ -10361,7 +10363,7 @@ class IntegratedPipeline:
10361
10363
  if need_ensemble:
10362
10364
  fresh_probs, _ = self.ensemble.predict_ensemble(
10363
10365
  fresh_input_ids, fresh_X_raw,
10364
- np.zeros((len(fresh_ids), num_classes)),
10366
+ np.zeros((len(fresh_input_ids), num_classes)),
10365
10367
  method='dynamic', embedded=embedded
10366
10368
  )
10367
10369
  else:
@@ -10382,7 +10384,7 @@ class IntegratedPipeline:
10382
10384
  if np.std(fresh_probs) < 0.3 or np.mean(fresh_probs) < 0.3:
10383
10385
  fresh_probs, _ = self.ensemble.predict_ensemble(
10384
10386
  fresh_input_ids, fresh_X_raw,
10385
- np.zeros((len(fresh_ids), num_classes)),
10387
+ np.zeros((len(fresh_input_ids), num_classes)),
10386
10388
  method='dynamic', embedded=embedded
10387
10389
  )
10388
10390
 
@@ -13863,7 +13865,7 @@ class PipelineAsyncManager:
13863
13865
  except (KeyError, IndexError):
13864
13866
  final_idx = None
13865
13867
 
13866
- print(f'[=+=] Local single advanced prediction: {result}')
13868
+ print(f'[=+=] Local single advanced prediction: {result.get("predicted", "N/A") if isinstance(result, dict) else result} With confidence: {confidence if confidence is not None else "N/A"}')
13867
13869
  print('[=] Initiating batch prediction...')
13868
13870
 
13869
13871
  results = self.predict_batch(
@@ -14636,11 +14638,8 @@ class PipelinePredictionManager:
14636
14638
  # Only recalibrate if models disagreed AND we have valid results
14637
14639
  if results and not results[0].get('models_agree', True):
14638
14640
  print("\n[⚠️] Disagreement detected between MLP and Transformer predictions. Using calibrated probabilities for final decision.")
14639
- try:
14640
- calibrated_probs = self.pipeline.hybrid_prediction(input_ids, X, batch_size=batch_size, embedded=True)
14641
- except:
14642
- calibrated_probs = self.pipeline.hybrid_prediction(input_ids, X, batch_size=batch_size, embedded=False)
14643
-
14641
+ calibrated_probs = self.pipeline.hybrid_prediction(rules, input_ids, dataset)
14642
+
14644
14643
  if calibrated_probs is not None and len(calibrated_probs) > 0:
14645
14644
  final_idx = int(np.argmax(calibrated_probs[:num_classes]))
14646
14645
  if final_idx > len(reverse_map):
@@ -14670,14 +14669,7 @@ class PipelinePredictionManager:
14670
14669
 
14671
14670
  return results
14672
14671
 
14673
- def hybrid_model_prediction(self, datasets, X_raw, batch_size=2):
14674
- self.pipeline.transformer_utilities(datasets, X_raw, batch_size=batch_size)
14675
- input_datasets = self.pipeline.transformer_input_encoding([i[0] for i in datasets])
14676
14672
 
14677
- probs = self.model.predict_proba(input_datasets, X_raw, type='Hybrid')[0]
14678
- pred = self.model.hybrid_prediction(input_datasets, X_raw)
14679
-
14680
- return probs, pred
14681
14673
 
14682
14674
  def robust_prediction(self, pipeline, titles, label_map, X_raw=None, y=None, show_proba=True, top_k=3, batch_size=2):
14683
14675
  self.pipeline.titles = titles
@@ -14901,6 +14893,10 @@ class PipelinePredictionManager:
14901
14893
  anisotropy = None
14902
14894
  final_class_idx = None
14903
14895
  AME = None
14896
+ use_embedded = False
14897
+
14898
+ if titles is None or label_map is None or rules is None:
14899
+ raise ValueError("[!] Titles, label_map, and rules must be provided for all prediction methods!")
14904
14900
 
14905
14901
  print("\n[🚀] Starting Advanced Hybrid Prediction Method")
14906
14902
 
@@ -14921,7 +14917,6 @@ class PipelinePredictionManager:
14921
14917
  input_ids, _ = self.pipeline.input_encoding(dataset)
14922
14918
 
14923
14919
  if use_transformer and hasattr(self.pipeline, 'vocab') and self.pipeline.vocab:
14924
- use_embedded = False
14925
14920
  print("\n[🔄] Running dual predictions (MLP + Transformer)")
14926
14921
 
14927
14922
  input_ids_list = []
@@ -15165,13 +15160,13 @@ class PipelinePredictionManager:
15165
15160
  final_probs = mlp_probs[i]
15166
15161
  final_probs = self.calibration_penalized_check(final_probs, mlp_class_idx)
15167
15162
 
15168
- final_class_idx = mlp_class_idx
15169
- final_confidence = mlp_confidence[0] if isinstance(mlp_confidence, np.ndarray) else mlp_confidence
15163
+ final_class_idx = target_class_idx
15164
+ final_confidence = target_confidence[0] if isinstance(target_confidence, np.ndarray) else target_confidence
15170
15165
  if isinstance(final_confidence, np.ndarray) or isinstance(final_confidence, list):
15171
15166
  final_confidence = np.max(final_confidence)
15172
15167
 
15173
15168
  trans_label = None
15174
- trans_confidence = None
15169
+ trans_confidence = 0.0
15175
15170
  agreement = False
15176
15171
 
15177
15172
  final_label = reverse_map.get(final_class_idx, f"unknown_{final_class_idx}")
@@ -15310,11 +15305,8 @@ class PipelinePredictionManager:
15310
15305
  elif not results[0].get('models_agree', True) and confidence > self.pipeline.confidence_threshold:
15311
15306
  if final_confidence is not None and confidence < self.pipeline.confidence_threshold:
15312
15307
  print("\n[⚠️] Low confidence detected, but both models don't agree. Using calibrated probabilities for final decision to ensure robustness.")
15313
- try:
15314
- final_probs = self.pipeline.hybrid_prediction(input_ids, X, batch_size=batch_size, embedded=True)
15315
- except:
15316
- final_probs = self.pipeline.hybrid_prediction(input_ids, X, batch_size=batch_size, embedded=False)
15317
-
15308
+ final_probs = self.pipeline.hybrid_prediction(rules, input_ids, dataset)
15309
+
15318
15310
  final_idx = final_probs[0].argmax()
15319
15311
  original_idx = final_idx
15320
15312
 
@@ -15324,11 +15316,8 @@ class PipelinePredictionManager:
15324
15316
  final_idx = int(final_idx)
15325
15317
  else:
15326
15318
  print('[🎯] Stable confidence established, But both Models doesnt Agree, Re-evaluating...')
15327
- try:
15328
- final_probs = self.pipeline.hybrid_prediction(input_ids, X, batch_size=batch_size, embedded=True)
15329
- except:
15330
- final_probs = self.pipeline.hybrid_prediction(input_ids, X, batch_size=batch_size, embedded=False)
15331
-
15319
+ final_probs = self.pipeline.hybrid_prediction(rules, input_ids, dataset)
15320
+
15332
15321
  final_idx = final_probs[0].argmax()
15333
15322
  original_idx = final_idx
15334
15323
  if final_idx > len(reverse_map):
@@ -15345,11 +15334,8 @@ class PipelinePredictionManager:
15345
15334
  if self.pipeline.use_transformer and need_ensemble_method:
15346
15335
  print("\n[⚠️] Uncertain confidence and disagreement detected. Using ensemble method for final decision.")
15347
15336
  input_forward = sequence_ids if sequence_ids is not None else input_ids
15348
- try:
15349
- final_probs, details = self.pipeline.ensemble.predict_ensemble(input_forward, X, y, method='dynamic', embedded=True)
15350
- except:
15351
- final_probs, details = self.pipeline.ensemble.predict_ensemble(input_forward, X, y, method='dynamic', embedded=False)
15352
-
15337
+ final_probs, details = self.pipeline.ensemble.predict_ensemble(input_forward, X, y, method='dynamic', embedded=use_embedded)
15338
+
15353
15339
  final_idx = final_probs[0].argmax()
15354
15340
  original_idx = final_idx
15355
15341
 
@@ -15364,10 +15350,8 @@ class PipelinePredictionManager:
15364
15350
  except:
15365
15351
  confidence = float(final_probs[0][len(reverse_map)-1]) if isinstance(final_probs[0], (float, int)) else 0.0
15366
15352
  else:
15367
- try:
15368
- final_probs = self.calibration_penalized_check(final_probs, target_pred_indices[0])
15369
- except:
15370
- final_probs = target_probs
15353
+ final_probs = self.calibration_penalized_check(final_probs, target_pred_indices[0])
15354
+
15371
15355
  final_idx = final_probs[0].argmax() if final_probs is not None else target_probs[0].argmax()
15372
15356
 
15373
15357
  original_idx = final_idx