Spaces:
Running
Running
TeleologyHI
commited on
Commit
·
8db4a14
1
Parent(s):
f599e3d
up
Browse files- src/core/awareness_engine.py +15 -2
- src/core/integration_manager.py +16 -3
- src/core/states.py +10 -1
src/core/awareness_engine.py
CHANGED
@@ -2,7 +2,7 @@ from typing import Dict, Any
|
|
2 |
import torch
|
3 |
import torch.nn as nn
|
4 |
import numpy as np
|
5 |
-
from .states import AwarenessState
|
6 |
|
7 |
class AwarenessEngine:
|
8 |
def __init__(self):
|
@@ -15,14 +15,27 @@ class AwarenessEngine:
|
|
15 |
async def process(self, input_state: Dict[str, Any]) -> AwarenessState:
|
16 |
attention_vector = self._compute_attention(input_state)
|
17 |
awareness_level = self._calculate_awareness(attention_vector)
|
|
|
18 |
|
19 |
return AwarenessState(
|
20 |
attention_vector=attention_vector.detach().numpy(),
|
21 |
awareness_level=awareness_level,
|
22 |
cognitive_state=self._process_cognitive_state(input_state),
|
23 |
emotional_valence=self._compute_emotional_valence(input_state),
|
24 |
-
consciousness_level=0.8
|
|
|
25 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
def _compute_attention(self, input_state: Dict[str, Any]) -> torch.Tensor:
|
28 |
return torch.ones(256)
|
|
|
2 |
import torch
|
3 |
import torch.nn as nn
|
4 |
import numpy as np
|
5 |
+
from .states import AwarenessState, AwarenessLevel
|
6 |
|
7 |
class AwarenessEngine:
|
8 |
def __init__(self):
|
|
|
15 |
async def process(self, input_state: Dict[str, Any]) -> AwarenessState:
|
16 |
attention_vector = self._compute_attention(input_state)
|
17 |
awareness_level = self._calculate_awareness(attention_vector)
|
18 |
+
level = self._determine_awareness_level(awareness_level)
|
19 |
|
20 |
return AwarenessState(
|
21 |
attention_vector=attention_vector.detach().numpy(),
|
22 |
awareness_level=awareness_level,
|
23 |
cognitive_state=self._process_cognitive_state(input_state),
|
24 |
emotional_valence=self._compute_emotional_valence(input_state),
|
25 |
+
consciousness_level=0.8,
|
26 |
+
level=level
|
27 |
)
|
28 |
+
|
29 |
+
def _determine_awareness_level(self, awareness_level: float) -> AwarenessLevel:
|
30 |
+
if awareness_level > 0.8:
|
31 |
+
return AwarenessLevel.TRANSCENDENT
|
32 |
+
elif awareness_level > 0.6:
|
33 |
+
return AwarenessLevel.INTEGRATED
|
34 |
+
elif awareness_level > 0.4:
|
35 |
+
return AwarenessLevel.REFLECTIVE
|
36 |
+
elif awareness_level > 0.2:
|
37 |
+
return AwarenessLevel.PERCEPTUAL
|
38 |
+
return AwarenessLevel.BASIC
|
39 |
|
40 |
def _compute_attention(self, input_state: Dict[str, Any]) -> torch.Tensor:
|
41 |
return torch.ones(256)
|
src/core/integration_manager.py
CHANGED
@@ -61,10 +61,10 @@ class IntegratedState(Generic[T]):
|
|
61 |
teleological_vector: Optional[Dict[str, float]] = None
|
62 |
|
63 |
|
64 |
-
from typing import Dict, Any
|
65 |
import torch
|
66 |
import torch.nn as nn
|
67 |
-
from .states import AwarenessState
|
68 |
|
69 |
class IntegrationManager:
|
70 |
def __init__(self):
|
@@ -78,11 +78,24 @@ class IntegrationManager:
|
|
78 |
if not isinstance(awareness, AwarenessState):
|
79 |
raise ValueError("Primary awareness state must be of type AwarenessState")
|
80 |
|
|
|
|
|
81 |
return {
|
82 |
"integrated_state": self._integrate_awareness(awareness),
|
83 |
"consciousness_level": awareness.consciousness_level,
|
84 |
-
"emotional_context": {"valence": awareness.emotional_valence}
|
|
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
def _integrate_awareness(self, awareness: AwarenessState) -> Dict[str, Any]:
|
88 |
return {
|
|
|
61 |
teleological_vector: Optional[Dict[str, float]] = None
|
62 |
|
63 |
|
64 |
+
from typing import Dict, Any, List
|
65 |
import torch
|
66 |
import torch.nn as nn
|
67 |
+
from .states import AwarenessState, AwarenessLevel
|
68 |
|
69 |
class IntegrationManager:
|
70 |
def __init__(self):
|
|
|
78 |
if not isinstance(awareness, AwarenessState):
|
79 |
raise ValueError("Primary awareness state must be of type AwarenessState")
|
80 |
|
81 |
+
emergent_properties = await self._generate_emergent_properties(awareness)
|
82 |
+
|
83 |
return {
|
84 |
"integrated_state": self._integrate_awareness(awareness),
|
85 |
"consciousness_level": awareness.consciousness_level,
|
86 |
+
"emotional_context": {"valence": awareness.emotional_valence},
|
87 |
+
"emergent_properties": emergent_properties
|
88 |
}
|
89 |
+
|
90 |
+
async def _generate_emergent_properties(self, primary: AwarenessState) -> Dict[str, Any]:
|
91 |
+
return {
|
92 |
+
"awareness_depth": self._calculate_awareness_depth(primary),
|
93 |
+
"integration_level": primary.awareness_level,
|
94 |
+
"consciousness_state": str(primary.level)
|
95 |
+
}
|
96 |
+
|
97 |
+
def _calculate_awareness_depth(self, primary: AwarenessState) -> float:
|
98 |
+
return primary.level.value / len(AwarenessLevel)
|
99 |
|
100 |
def _integrate_awareness(self, awareness: AwarenessState) -> Dict[str, Any]:
|
101 |
return {
|
src/core/states.py
CHANGED
@@ -1,6 +1,14 @@
|
|
1 |
from dataclasses import dataclass
|
2 |
from typing import Dict, Any
|
3 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
@dataclass
|
6 |
class AwarenessState:
|
@@ -8,4 +16,5 @@ class AwarenessState:
|
|
8 |
awareness_level: float
|
9 |
cognitive_state: Dict[str, Any]
|
10 |
emotional_valence: float
|
11 |
-
consciousness_level: float
|
|
|
|
1 |
from dataclasses import dataclass
|
2 |
from typing import Dict, Any
|
3 |
import numpy as np
|
4 |
+
from enum import Enum
|
5 |
+
|
6 |
+
class AwarenessLevel(Enum):
|
7 |
+
BASIC = 1
|
8 |
+
PERCEPTUAL = 2
|
9 |
+
REFLECTIVE = 3
|
10 |
+
INTEGRATED = 4
|
11 |
+
TRANSCENDENT = 5
|
12 |
|
13 |
@dataclass
|
14 |
class AwarenessState:
|
|
|
16 |
awareness_level: float
|
17 |
cognitive_state: Dict[str, Any]
|
18 |
emotional_valence: float
|
19 |
+
consciousness_level: float
|
20 |
+
level: AwarenessLevel = AwarenessLevel.BASIC
|