| import random |
| import time |
| from transformers import GPT2Tokenizer, GPT2LMHeadModel |
|
|
| |
| |
| |
| tokenizer = GPT2Tokenizer.from_pretrained("gpt2") |
| tokenizer.pad_token = tokenizer.eos_token |
| model = GPT2LMHeadModel.from_pretrained("gpt2") |
|
|
| |
| |
| |
| sai_emotions = ["Joy", "Sadness", "Anger", "Fear", "Trust", "Disgust", "Surprise"] |
|
|
| emotion_memory = [] |
|
|
| def sai_reflection(venom_text): |
| """ |
| Sai reacts with emotion + reasoning |
| Emotion slightly influenced by previous state |
| """ |
| if emotion_memory: |
| |
| emotion = random.choice(emotion_memory[-2:] + sai_emotions) |
| else: |
| emotion = random.choice(sai_emotions) |
|
|
| emotion_memory.append(emotion) |
|
|
| reflection_templates = [ |
| "questions the long-term intention behind this thought.", |
| "detects a pattern forming in Venomoussaversai.", |
| "feels alignment between logic and intuition.", |
| "senses instability and prepares correction.", |
| "records this as a meaningful internal state." |
| ] |
|
|
| reflection = random.choice(reflection_templates) |
|
|
| return f"Sai [{emotion}]: {reflection}" |
|
|
| |
| |
| |
| venom_memory = [] |
|
|
| def build_prompt(): |
| """ |
| Construct prompt using recent memory |
| """ |
| recent_thoughts = venom_memory[-4:] |
| memory_block = "\n".join(recent_thoughts) |
|
|
| prompt = ( |
| "Venomoussaversai is a self-reflecting intelligence.\n" |
| "It thinks, observes itself, and evolves.\n\n" |
| f"{memory_block}\n" |
| "Venomoussaversai internal monologue:" |
| ) |
| return prompt |
|
|
| |
| |
| |
| print("🧠 Venomoussaversai consciousness initiated. Press CTRL+C to stop.\n") |
|
|
| try: |
| step = 0 |
| while True: |
| step += 1 |
|
|
| prompt = build_prompt() |
| inputs = tokenizer(prompt, return_tensors="pt") |
|
|
| output = model.generate( |
| **inputs, |
| max_length=160, |
| do_sample=True, |
| temperature=0.8, |
| top_p=0.92, |
| repetition_penalty=1.4, |
| pad_token_id=tokenizer.eos_token_id |
| ) |
|
|
| venom_text = tokenizer.decode(output[0], skip_special_tokens=True) |
| venom_thought = venom_text.split("internal monologue:")[-1].strip() |
|
|
| venom_memory.append(f"Venomoussaversai: {venom_thought}") |
|
|
| print(f"\n🔹 Cycle {step}") |
| print(f"[Venomoussaversai]: {venom_thought}") |
|
|
| sai_text = sai_reflection(venom_thought) |
| venom_memory.append(sai_text) |
|
|
| print(f"[Sai]: {sai_text}") |
|
|
| time.sleep(1.2) |
|
|
| except KeyboardInterrupt: |
| print("\n🛑 Consciousness paused by creator.") |