cognitive-engine 0.2.1__tar.gz → 0.2.3__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.
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/PKG-INFO +1 -1
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/nlp/models.py +17 -8
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine.egg-info/PKG-INFO +1 -1
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/pyproject.toml +1 -1
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/README.md +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/adapters/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/adapters/plastic_numeric_adapter.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/api/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/api/service.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/compression/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/compression/knowledge_compressor.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/compression/semantic_compressor_v2.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/config/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/config/loader.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/config/schema.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/consolidation/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/consolidation/engine.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/consolidation/engine_v2.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/context/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/context/long_context.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/core/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/core/builder.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/core/engine.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/core/engine_v2.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/core/registry.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/core/types.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/interfaces/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/interfaces/base.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/memory/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/memory/graph_memory.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/memory/hybrid_memory.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/memory/project_memory.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/memory/stores.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/memory/vector_store.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/models/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/models/stable_core.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/modules/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/modules/importance_evaluator.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/modules/input_processing.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/modules/semantic_understanding.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/nlp/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/nlp/trainer.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/replay/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/replay/buffer.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/routing/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/routing/dynamic_router.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/routing/learned_router.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/specialists/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/specialists/runtime.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/stability/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/stability/governor.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/training/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/training/online_trainer.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/utils/__init__.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/utils/numeric.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/utils/seeding.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/utils/telemetry.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/utils/text.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/utils/visualization.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine.egg-info/SOURCES.txt +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine.egg-info/dependency_links.txt +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine.egg-info/requires.txt +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine.egg-info/top_level.txt +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/setup.cfg +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/tests/test_engine_smoke.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/tests/test_engine_v2.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/tests/test_learned_router_v2.py +0 -0
- {cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/tests/test_numeric_training.py +0 -0
|
@@ -4,6 +4,7 @@ import torch
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from cognitive_engine import EngineBuilder
|
|
6
6
|
from cognitive_engine.core.engine import CognitiveEngine
|
|
7
|
+
from cognitive_engine.config.schema import EngineConfig
|
|
7
8
|
|
|
8
9
|
class CognitiveModel:
|
|
9
10
|
"""
|
|
@@ -31,8 +32,10 @@ class CognitiveModel:
|
|
|
31
32
|
config_dict = json.load(f)
|
|
32
33
|
|
|
33
34
|
# En un escenario real, cargaríamos el state_dict de los submodelos (StableCore, etc)
|
|
34
|
-
# Aquí reconstruimos el engine con la configuración
|
|
35
|
-
|
|
35
|
+
# Aquí reconstruimos el engine con la configuración por defecto o la cargada
|
|
36
|
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
37
|
+
config = EngineConfig(device=device)
|
|
38
|
+
engine = EngineBuilder(config=config).build_v2()
|
|
36
39
|
|
|
37
40
|
# Simulamos la carga de pesos si existen
|
|
38
41
|
weights_path = path / "pytorch_model.bin"
|
|
@@ -72,10 +75,13 @@ class CognitiveTranslator(CognitiveModel):
|
|
|
72
75
|
Modelo optimizado para tareas Text-to-Text (e.g. Traducción).
|
|
73
76
|
Usa el Stable Core para generar texto a partir del contexto recuperado en memoria.
|
|
74
77
|
"""
|
|
75
|
-
def __init__(self, engine=None, source_lang="en", target_lang="es"):
|
|
78
|
+
def __init__(self, engine=None, source_lang="en", target_lang="es", device=None):
|
|
79
|
+
if device is None:
|
|
80
|
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
76
81
|
if engine is None:
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
config = EngineConfig(device=device)
|
|
83
|
+
engine = EngineBuilder(config=config).build_v2()
|
|
84
|
+
config_dict = {"source_lang": source_lang, "target_lang": target_lang, "task": "translation", "device": device}
|
|
79
85
|
super().__init__(engine, config_dict)
|
|
80
86
|
self.source_lang = source_lang
|
|
81
87
|
self.target_lang = target_lang
|
|
@@ -97,10 +103,13 @@ class CognitiveEncoder(CognitiveModel):
|
|
|
97
103
|
"""
|
|
98
104
|
Modelo optimizado para extraer representaciones densas (embeddings) tipo BERT.
|
|
99
105
|
"""
|
|
100
|
-
def __init__(self, engine=None):
|
|
106
|
+
def __init__(self, engine=None, device=None):
|
|
107
|
+
if device is None:
|
|
108
|
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
101
109
|
if engine is None:
|
|
102
|
-
|
|
103
|
-
|
|
110
|
+
config = EngineConfig(device=device)
|
|
111
|
+
engine = EngineBuilder(config=config).build_v2()
|
|
112
|
+
config_dict = {"task": "encoding", "device": device}
|
|
104
113
|
super().__init__(engine, config_dict)
|
|
105
114
|
|
|
106
115
|
def encode(self, text: str):
|
|
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
|
|
File without changes
|
|
File without changes
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/consolidation/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/consolidation/engine_v2.py
RENAMED
|
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
|
|
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
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/modules/importance_evaluator.py
RENAMED
|
File without changes
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/modules/input_processing.py
RENAMED
|
File without changes
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/modules/semantic_understanding.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/routing/dynamic_router.py
RENAMED
|
File without changes
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/routing/learned_router.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine/training/online_trainer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cognitive_engine-0.2.1 → cognitive_engine-0.2.3}/cognitive_engine.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|