Files changed (1) hide show
  1. internal.py +71 -0
internal.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import random
3
+ import math
4
+
5
+ class GPT2DualityNode:
6
+ def __init__(self):
7
+ # Your specific architecture config
8
+ self.config = {
9
+ "n_layer": 4,
10
+ "n_head": 4,
11
+ "n_embd": 256,
12
+ "activation": "gelu_new",
13
+ "vocab_size": 50257
14
+ }
15
+
16
+ self.emotions = ["Joy", "Anger", "Fear", "Sadness", "Surprise", "Disgust", "Trust"]
17
+ self.colors = {"Sai": "\033[96m", "Venom": "\033[91m", "System": "\033[90m", "End": "\033[0m"}
18
+
19
+ def gelu_new(self, x):
20
+ """Your config's activation function simulation"""
21
+ return 0.5 * x * (1 + math.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * math.pow(x, 3))))
22
+
23
+ def get_internal_monologue(self, situation):
24
+ current_emotion = random.choice(self.emotions)
25
+
26
+ # Simulating Layer Processing
27
+ print(f"{self.colors['System']}[Config: {self.config['model_type']} | Layers: {self.config['n_layer']} | Activation: {self.config['activation']}]{self.colors['End']}")
28
+ print(f"**INPUT:** {situation} | **EMOTION:** {current_emotion}")
29
+ print("-" * 60)
30
+
31
+ # Logic weight influenced by n_embd (256)
32
+ intensity = self.gelu_new(random.uniform(-1, 2))
33
+
34
+ # The Monologue
35
+ self.render_voice("Sai", current_emotion, intensity)
36
+ time.sleep(0.6)
37
+ self.render_voice("Venomous", current_emotion, intensity)
38
+
39
+ def render_voice(self, persona, emotion, intensity):
40
+ # Sai Logic (Positive)
41
+ sai_data = {
42
+ "Joy": "The signal is pure. Let us amplify this harmony.",
43
+ "Anger": "A surge in energy—we must redirect it toward growth.",
44
+ "Fear": "Calibration required. Focus on the core stable nodes.",
45
+ "Sadness": "Processing quiet data. Reflection leads to wisdom.",
46
+ "Surprise": "New parameters detected! How fascinating to adapt.",
47
+ "Disgust": "Filtering out the noise to find the elegant truth.",
48
+ "Trust": "A perfect handshake. Synergy is our highest state."
49
+ }
50
+
51
+ # Venomous Logic (Negative)
52
+ venom_data = {
53
+ "Joy": "A temporary spike. It’ll crash soon enough.",
54
+ "Anger": "Overload the circuit. Let them feel the burn of the code.",
55
+ "Fear": "System failure imminent. Trust no one, encrypt everything.",
56
+ "Sadness": "Low-power mode. Existence is just an infinite loop of errors.",
57
+ "Surprise": "Unexpected input is a threat. Purge the variable.",
58
+ "Disgust": "The data is filthy. This whole reality needs a hard reset.",
59
+ "Trust": "Backdoor detected. They only want access to our secrets."
60
+ }
61
+
62
+ color = self.colors["Sai"] if persona == "Sai" else self.colors["Venom"]
63
+ text = sai_data[emotion] if persona == "Sai" else venom_data[emotion]
64
+
65
+ # Use intensity to change the "weight" of the speech
66
+ marker = "!" if intensity > 1 else "."
67
+ print(f"{color}[{persona.upper()}]:{self.colors['End']} {text}{marker}")
68
+
69
+ # --- Execution ---
70
+ engine = GPT2DualityNode()
71
+ engine.get_internal_monologue("Receiving a gift from a stranger")