AbstractIntegratedModule 0.9.0__tar.gz → 0.9.1__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.0 → abstractintegratedmodule-0.9.1}/AbstractIntegratedModule.egg-info/PKG-INFO +3 -3
  2. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/AbstractIntegratedModule.py +71 -14
  3. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/AbstractOptimizedModules.c +200 -200
  4. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/PKG-INFO +3 -3
  5. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/README.md +2 -2
  6. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/setup.py +1 -1
  7. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/AbstractIntegratedModule.egg-info/SOURCES.txt +0 -0
  8. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/AbstractIntegratedModule.egg-info/dependency_links.txt +0 -0
  9. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/AbstractIntegratedModule.egg-info/requires.txt +0 -0
  10. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/AbstractIntegratedModule.egg-info/top_level.txt +0 -0
  11. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/AbstractOptimizedModules.pyx +0 -0
  12. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/MANIFEST.in +0 -0
  13. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/Cargo.toml +0 -0
  14. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/pyproject.toml +0 -0
  15. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/src/lib.rs +0 -0
  16. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/target/debug/build/libsqlite3-sys-ed07b882cd2aa5e2/out/bindgen.rs +0 -0
  17. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/target/debug/build/serde_core-ebc15f2e9cad7f5f/out/private.rs +0 -0
  18. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/target/debug/build/target-lexicon-08527f45de28143d/out/host.rs +0 -0
  19. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/target/release/build/libsqlite3-sys-bf0400df4523274c/out/bindgen.rs +0 -0
  20. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/target/release/build/serde_core-5cdb76131825e4af/out/private.rs +0 -0
  21. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/abstract_model_storage/target/release/build/target-lexicon-43eb95a0588bf457/out/host.rs +0 -0
  22. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/pyproject.toml +0 -0
  23. {abstractintegratedmodule-0.9.0 → abstractintegratedmodule-0.9.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AbstractIntegratedModule
3
- Version: 0.9.0
3
+ Version: 0.9.1
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.0 Official Release.
45
+ - Development Stage: 0.9.1 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,7 +80,7 @@ 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.0:
83
+ - v0.9.1:
84
84
  - [=] New features:
85
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
86
  - Modifed advanced prediction to use single pass prediction as its main prediction method, ensemble prediction will be triggered when conditions are met.
@@ -10177,7 +10177,11 @@ class IntegratedPipeline:
10177
10177
  )
10178
10178
  else:
10179
10179
  fresh_probs = self.model3.forward(fresh_X)
10180
- fresh_trans_probs, _ = self.model2.forward(fresh_ids, embedded=False)
10180
+ try:
10181
+ fresh_trans_probs, _ = self.model2.forward(fresh_input_ids, embedded=False)
10182
+ except:
10183
+ fresh_trans_probs, _ = self.model2.forward(fresh_input_ids, embedded=True)
10184
+
10181
10185
  fresh_mlp_confidence = fresh_probs.max(axis=1, keepdims=True)
10182
10186
  fresh_trans_confidence = fresh_trans_probs.max(axis=1, keepdims=True)
10183
10187
 
@@ -10324,7 +10328,7 @@ class IntegratedPipeline:
10324
10328
  return result[0]
10325
10329
 
10326
10330
 
10327
- def _batch_hybrid_prediction(self, batch_input_ids, batch_X_raw, y_true):
10331
+ def _batch_hybrid_prediction(self, batch_input_ids, batch_X_raw, y_true, embedded=True):
10328
10332
  print('[+] Initiating hybrid prediction batching...')
10329
10333
 
10330
10334
  num_classes = self._get_num_classes()
@@ -10337,6 +10341,10 @@ class IntegratedPipeline:
10337
10341
  fresh_probs = None # FIX 1 — explicit init, no UnboundLocalError
10338
10342
 
10339
10343
  needs_prediction = [i for i, p in enumerate(batch_probs) if p is None]
10344
+ need_ensemble = (
10345
+ len(chunk_ids) > 100 and
10346
+ len(chunk_X) > 100
10347
+ )
10340
10348
 
10341
10349
  if needs_prediction:
10342
10350
  fresh_input_ids = batch_input_ids[needs_prediction]
@@ -10350,10 +10358,33 @@ class IntegratedPipeline:
10350
10358
  else:
10351
10359
  fresh_y_true = np.zeros((len(needs_prediction), num_classes))
10352
10360
 
10353
- fresh_probs, details = self.ensemble.predict_ensemble(
10354
- fresh_input_ids, fresh_X_raw, fresh_y_true,
10355
- method='dynamic', embedded=False
10356
- )
10361
+ if need_ensemble:
10362
+ fresh_probs, _ = self.ensemble.predict_ensemble(
10363
+ fresh_input_ids, fresh_X_raw,
10364
+ np.zeros((len(fresh_ids), num_classes)),
10365
+ method='dynamic', embedded=embedded
10366
+ )
10367
+ else:
10368
+ fresh_probs = self.model3.forward(fresh_X_raw)
10369
+ try:
10370
+ fresh_trans_probs, _ = self.model2.forward(fresh_input_ids, embedded=False)
10371
+ except:
10372
+ fresh_trans_probs, _ = self.model2.forward(fresh_input_ids, embedded=embedded)
10373
+
10374
+ fresh_mlp_confidence = fresh_probs.max(axis=1, keepdims=True)
10375
+ fresh_trans_confidence = fresh_trans_probs.max(axis=1, keepdims=True)
10376
+
10377
+ if fresh_mlp_confidence >= fresh_trans_confidence:
10378
+ fresh_probs = fresh_probs.copy()
10379
+ else:
10380
+ fresh_probs = fresh_trans_probs.copy()
10381
+
10382
+ if np.std(fresh_probs) < 0.3 or np.mean(fresh_probs) < 0.3:
10383
+ fresh_probs, _ = self.ensemble.predict_ensemble(
10384
+ fresh_input_ids, fresh_X_raw,
10385
+ np.zeros((len(fresh_ids), num_classes)),
10386
+ method='dynamic', embedded=embedded
10387
+ )
10357
10388
 
10358
10389
  # validate fresh_probs shape before assignment
10359
10390
  fresh_probs = np.asarray(fresh_probs)
@@ -10536,9 +10567,15 @@ class IntegratedPipeline:
10536
10567
 
10537
10568
  def hybrid_prediction(self, rules, input_ids, dataset):
10538
10569
  X, y, _, _ = self.feature_generation(rules, dataset)
10570
+ if isinstance(input_ids, list):
10571
+ try:
10572
+ input_ids = np.asarray(input_ids)
10573
+ except Exception as e:
10574
+ input_ids = self._safe_to_2d_float(input_ids)
10575
+
10539
10576
  if len(input_ids.shape) == 2 and input_ids.shape[0] > 1:
10540
10577
  # this is batch mode version
10541
- return self._batch_hybrid_prediction(input_ids, X, y)
10578
+ return self._batch_hybrid_prediction(input_ids, X, y, embedded=embedded)
10542
10579
 
10543
10580
  probs = self.model_memory_gate(input_ids, X)
10544
10581
 
@@ -14599,8 +14636,11 @@ class PipelinePredictionManager:
14599
14636
  # Only recalibrate if models disagreed AND we have valid results
14600
14637
  if results and not results[0].get('models_agree', True):
14601
14638
  print("\n[⚠️] Disagreement detected between MLP and Transformer predictions. Using calibrated probabilities for final decision.")
14602
- calibrated_probs = self.pipeline.hybrid_prediction(input_ids, X, batch_size=batch_size)
14603
-
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
+
14604
14644
  if calibrated_probs is not None and len(calibrated_probs) > 0:
14605
14645
  final_idx = int(np.argmax(calibrated_probs[:num_classes]))
14606
14646
  if final_idx > len(reverse_map):
@@ -14909,6 +14949,7 @@ class PipelinePredictionManager:
14909
14949
  print("\n[⚡] Running MLP-only predictions")
14910
14950
  print("[⚡] Note: Transformer not available, so Transformer results will be replaced with MLP results.")
14911
14951
  anisotropy = self.pipeline.anisotropy_measurement(X) if X is not None else self.pipeline.confidence_threshold
14952
+
14912
14953
  AME = self.pipeline.model2.AME_Encoder(X) if X is not None else self.pipeline.confidence_threshold
14913
14954
 
14914
14955
  if X is None or len(X) == 0 or isinstance(X, int) or (isinstance(X, np.ndarray) and X.size == 0):
@@ -14975,7 +15016,11 @@ class PipelinePredictionManager:
14975
15016
  print(f'[!] Similarity: {cached['similarity']} is low, Cannot pick label due to low certainty, Initiating advanced prediction...')
14976
15017
  else:
14977
15018
  print('[=] No verified output from cache available that matched samples, starting advanced prediction...')
14978
- target_probs = self.pipeline.predict_proba(input_ids, X, type='Hybrid', embedded=True)
15019
+ try:
15020
+ target_probs = self.pipeline.predict_proba(input_ids, X, type='Hybrid', embedded=True)
15021
+ except:
15022
+ target_probs = self.pipeline.predict_proba(input_ids, X, type='Hybrid', embedded=False)
15023
+
14979
15024
  target_probs = target_probs[:mlp_probs.shape[0], :mlp_probs.shape[1]]
14980
15025
  target_probs = self.pipeline.model3.continuos_predictive_correction(self, target_probs, mlp_pred_indices)
14981
15026
 
@@ -15265,7 +15310,10 @@ class PipelinePredictionManager:
15265
15310
  elif not results[0].get('models_agree', True) and confidence > self.pipeline.confidence_threshold:
15266
15311
  if final_confidence is not None and confidence < self.pipeline.confidence_threshold:
15267
15312
  print("\n[⚠️] Low confidence detected, but both models don't agree. Using calibrated probabilities for final decision to ensure robustness.")
15268
- final_probs = self.pipeline.hybrid_prediction(rules, input_ids, dataset)
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)
15269
15317
 
15270
15318
  final_idx = final_probs[0].argmax()
15271
15319
  original_idx = final_idx
@@ -15276,7 +15324,10 @@ class PipelinePredictionManager:
15276
15324
  final_idx = int(final_idx)
15277
15325
  else:
15278
15326
  print('[🎯] Stable confidence established, But both Models doesnt Agree, Re-evaluating...')
15279
- final_probs = self.pipeline.hybrid_prediction(rules, input_ids, dataset)
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)
15280
15331
 
15281
15332
  final_idx = final_probs[0].argmax()
15282
15333
  original_idx = final_idx
@@ -15294,7 +15345,10 @@ class PipelinePredictionManager:
15294
15345
  if self.pipeline.use_transformer and need_ensemble_method:
15295
15346
  print("\n[⚠️] Uncertain confidence and disagreement detected. Using ensemble method for final decision.")
15296
15347
  input_forward = sequence_ids if sequence_ids is not None else input_ids
15297
- final_probs, details = self.pipeline.ensemble.predict_ensemble(input_forward, X, y, method='dynamic', embedded=True)
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)
15298
15352
 
15299
15353
  final_idx = final_probs[0].argmax()
15300
15354
  original_idx = final_idx
@@ -15310,7 +15364,10 @@ class PipelinePredictionManager:
15310
15364
  except:
15311
15365
  confidence = float(final_probs[0][len(reverse_map)-1]) if isinstance(final_probs[0], (float, int)) else 0.0
15312
15366
  else:
15313
- final_probs = self.calibration_penalized_check(final_probs, target_pred_indices[0])
15367
+ try:
15368
+ final_probs = self.calibration_penalized_check(final_probs, target_pred_indices[0])
15369
+ except:
15370
+ final_probs = target_probs
15314
15371
  final_idx = final_probs[0].argmax() if final_probs is not None else target_probs[0].argmax()
15315
15372
 
15316
15373
  original_idx = final_idx