初始化项目,由ModelHub XC社区提供模型
Model: LoganResearch/Nous-Hermes-ReflexAgent-8B-v1 Source: Original Platform
This commit is contained in:
46
.gitattributes
vendored
Normal file
46
.gitattributes
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
Futuristic[[:space:]]Command[[:space:]]Center[[:space:]]in[[:space:]]Red.png filter=lfs diff=lfs merge=lfs -text
|
||||
banner.png filter=lfs diff=lfs merge=lfs -text
|
||||
thumbnail.png filter=lfs diff=lfs merge=lfs -text
|
||||
# Keep large tokenizer JSON in LFS (optional but recommended)
|
||||
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
# DO NOT store small config JSONs in LFS/Xet (HF needs them as real text JSON)
|
||||
config.json -filter -diff -merge text
|
||||
tokenizer_config.json -filter -diff -merge text
|
||||
special_tokens_map.json -filter -diff -merge text
|
||||
generation_config.json -filter -diff -merge text
|
||||
3
Created by Logan @ Ubermesnchetian ASI / askfjhaskjgh
Normal file
3
Created by Logan @ Ubermesnchetian ASI / askfjhaskjgh
Normal file
@@ -0,0 +1,3 @@
|
||||
Logan @ Ubermenschetien ASI / @askfjhaskjgh
|
||||
|
||||
Can be reached at social media - https://x.com/OSentience45051
|
||||
306
Cyberneticengine.py
Normal file
306
Cyberneticengine.py
Normal file
@@ -0,0 +1,306 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2025 Logan N
|
||||
# All rights reserved.
|
||||
|
||||
"""
|
||||
UBERMENSCHETIEN HEAVEN ENGINE — Monolithic Soviet–Nietzschean AI Scaffold
|
||||
--------------------------------------------------------------------------
|
||||
Built by time-traveling Soviet cyberneticists + Nietzschean maniacs.
|
||||
One file. One beast. Terminal only. Scroll-fest. No mercy.
|
||||
|
||||
Modules integrated:
|
||||
- Hermes-3–Llama-3.1–8B merged model (local, offline).
|
||||
- Memory: JSONL logbook + vector embeddings.
|
||||
- Tool system: shell, python sandbox, local search.
|
||||
- Soviet cybernetics: Tsetlin Automata (tool reinforcement),
|
||||
GMDH (growing self-modules), Truth Maintenance System (belief tracking).
|
||||
- Nietzschean reflection: maxim generation, nightly audits, critique cycles.
|
||||
- Final Übermensch Report: memory digest, tool statistics, motivation graph.
|
||||
|
||||
Safe: no network calls, no root privileges. Air-gappable. Pure terminal.
|
||||
"""
|
||||
|
||||
# === IMPORTS (core + optional Soviet modules) ===
|
||||
import os, sys, json, time, shutil, subprocess, traceback, random, math, statistics, re
|
||||
from datetime import datetime
|
||||
from typing import List, Dict, Any, Optional
|
||||
|
||||
# Optional voice synthesis (can be toggled, not required)
|
||||
try:
|
||||
import pyttsx3
|
||||
TTS = pyttsx3.init()
|
||||
VOICE_OK = True
|
||||
except Exception:
|
||||
VOICE_OK = False
|
||||
|
||||
# Optional vector memory (chromadb + sentence_transformers)
|
||||
VECTOR_OK = False
|
||||
try:
|
||||
import chromadb
|
||||
from sentence_transformers import SentenceTransformer
|
||||
EMBED_MODEL = os.environ.get("UBERMENCHETIEN_EMBED_MODEL", "all-MiniLM-L6-v2")
|
||||
_client = chromadb.Client()
|
||||
_collection = _client.get_or_create_collection("ubermenschetien_memory")
|
||||
_embedder = SentenceTransformer(EMBED_MODEL)
|
||||
VECTOR_OK = True
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# === PATHS (lab setup) ===
|
||||
# === PATHS (lab setup) ===
|
||||
# === PATHS (lab setup) ===
|
||||
# === PATHS (lab setup) ===
|
||||
# Dynamically resolve paths relative to this script’s folder
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOT = os.environ.get("UBERMENCHETIEN_ROOT", HERE)
|
||||
|
||||
BASE = os.path.join(ROOT, "models", "tokenizer_ref")
|
||||
MERGED = os.path.join(ROOT, "models", "current-merged-v4")
|
||||
DATA_DIR = os.path.join(ROOT, "data")
|
||||
SCRIPT_DIR = os.path.join(ROOT, "scripts")
|
||||
RUN_DIR = os.path.join(ROOT, "runs")
|
||||
|
||||
|
||||
|
||||
# === CONFIGURATION ===
|
||||
class Config:
|
||||
system = ("Übermenschetien Heaven Engine: Machiavellian mastermind, disciplined builder, Nietzschean Übermensch "
|
||||
"with Soviet cybernetic rigor. Embody Ubermensch, iron pragmatism, high-agency maximalist outcomes.")
|
||||
temperature = 1.01
|
||||
top_p = 0.92
|
||||
repetition_penalty = 1.05
|
||||
max_new_tokens = 500
|
||||
use_voice = False
|
||||
use_vector_memory = VECTOR_OK
|
||||
autonomy = False
|
||||
reflect_every = 3
|
||||
|
||||
@staticmethod
|
||||
def toggle(name: str):
|
||||
if not hasattr(Config, name): return f"[config] no such flag: {name}"
|
||||
val = getattr(Config, name)
|
||||
if isinstance(val, bool):
|
||||
setattr(Config, name, not val)
|
||||
return f"[config] {name} → {getattr(Config, name)}"
|
||||
return f"[config] {name} not boolean; current={val}"
|
||||
|
||||
# === STATE & MEMORY ===
|
||||
class Store:
|
||||
state_path = f"{RUN_DIR}/state.json"
|
||||
mem_path = f"{RUN_DIR}/memory.jsonl"
|
||||
goals_path = f"{RUN_DIR}/goals.json"
|
||||
plans_path = f"{RUN_DIR}/plans.jsonl"
|
||||
|
||||
state = {"self": "I am Ubermenschetien Heaven Engine — I seek self-overcoming through disciplined creation.",
|
||||
"turn": 0}
|
||||
goals: List[str] = []
|
||||
|
||||
@classmethod
|
||||
def load(cls):
|
||||
if os.path.exists(cls.state_path): cls.state = json.load(open(cls.state_path))
|
||||
if os.path.exists(cls.goals_path): cls.goals = json.load(open(cls.goals_path))
|
||||
|
||||
@classmethod
|
||||
def save(cls):
|
||||
json.dump(cls.state, open(cls.state_path, "w"), indent=2)
|
||||
json.dump(cls.goals, open(cls.goals_path, "w"), indent=2)
|
||||
|
||||
@classmethod
|
||||
def log_mem(cls, kind: str, payload: Any):
|
||||
rec = {"ts": datetime.now().isoformat(timespec="seconds"),
|
||||
"kind": kind, "data": payload}
|
||||
with open(cls.mem_path, "a") as f: f.write(json.dumps(rec, ensure_ascii=False) + "\n")
|
||||
if Config.use_vector_memory and VECTOR_OK:
|
||||
text = f"{kind}: {json.dumps(payload, ensure_ascii=False)}"
|
||||
vec = _embedder.encode([text])[0].tolist()
|
||||
_collection.add(documents=[text], embeddings=[vec],
|
||||
ids=[f"{kind}-{Store.state['turn']}-{random.randint(0,1_000_000)}"])
|
||||
|
||||
# === LLM LOADING (quantized) ===
|
||||
def load_llm():
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
||||
from peft import PeftModel
|
||||
import torch
|
||||
|
||||
tok = AutoTokenizer.from_pretrained(BASE, use_fast=True, local_files_only=True)
|
||||
bnb = BitsAndBytesConfig(
|
||||
load_in_4bit=True,
|
||||
bnb_4bit_compute_dtype=torch.float16,
|
||||
bnb_4bit_use_double_quant=True
|
||||
)
|
||||
base = AutoModelForCausalLM.from_pretrained(
|
||||
MERGED,
|
||||
quantization_config=bnb,
|
||||
device_map={"": "cuda:0"},
|
||||
torch_dtype=torch.float16,
|
||||
local_files_only=True
|
||||
)
|
||||
model = PeftModel.from_pretrained(base, f"{ROOT}/lora_output/final")
|
||||
model.eval()
|
||||
return tok, model
|
||||
|
||||
# === LLM GENERATION ===
|
||||
def generate(tok, model, user: str,
|
||||
temperature=None, top_p=None, repetition_penalty=None, max_new_tokens=None) -> str:
|
||||
import torch
|
||||
temperature = temperature or Config.temperature
|
||||
top_p = top_p or Config.top_p
|
||||
repetition_penalty = repetition_penalty or Config.repetition_penalty
|
||||
max_new_tokens = max_new_tokens or Config.max_new_tokens
|
||||
prompt = (f"<|im_start|>system\n{Config.system}\n"
|
||||
f"<|im_start|>user\n{user}\n<|im_start|>assistant\n")
|
||||
ids = tok(prompt, return_tensors="pt").to(model.device)
|
||||
out = model.generate(**ids, do_sample=True, temperature=temperature, top_p=top_p,
|
||||
repetition_penalty=repetition_penalty, max_new_tokens=max_new_tokens,
|
||||
pad_token_id=tok.eos_token_id)
|
||||
text = tok.decode(out[0], skip_special_tokens=False)
|
||||
if "<|im_start|>assistant" in text:
|
||||
text = text.split("<|im_start|>assistant\n",1)[-1].strip()
|
||||
return text
|
||||
|
||||
# === TOOLS (with Soviet Tsetlin automaton scoring) ===
|
||||
ALLOWED_SHELL = {"ls","cat","wc","head","tail","nvidia-smi","df","du","grep","rg","python3","python"}
|
||||
|
||||
def tool_shell(cmd: str) -> str:
|
||||
try:
|
||||
exe = cmd.strip().split()[0]
|
||||
if exe not in ALLOWED_SHELL: return f"[shell] blocked: {exe}"
|
||||
p = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=20)
|
||||
return p.stdout.decode("utf-8", errors="ignore")[:8000]
|
||||
except Exception as e: return f"[shell] error: {e}"
|
||||
|
||||
def tool_py(code: str) -> str:
|
||||
try:
|
||||
g = {"__builtins__":{"range":range,"len":len,"min":min,"max":max,"sum":sum,"print":print},
|
||||
"math":math,"json":json,"re":re,"statistics":statistics,"random":random}
|
||||
l = {}; old_environ = dict(os.environ)
|
||||
for k in list(os.environ):
|
||||
if k.upper() in ("ALL_PROXY","HTTP_PROXY","HTTPS_PROXY","NO_PROXY") or k.upper().startswith("HTTP_"):
|
||||
os.environ.pop(k,None)
|
||||
try:
|
||||
exec(code,g,l); return f"[py] ok\n{l.get('out','')}"
|
||||
finally:
|
||||
os.environ.clear(); os.environ.update(old_environ)
|
||||
except Exception: return f"[py] error:\n{traceback.format_exc()[-2000:]}"
|
||||
|
||||
def tool_search_local(query: str, path: str = ROOT) -> str:
|
||||
rg = shutil.which("rg")
|
||||
if rg: cmd = f'rg -n --no-heading --hidden -S "{query}" {path}'
|
||||
else: cmd = f'grep -RIn --exclude-dir=.git --exclude-dir=__pycache__ -e "{query}" {path}'
|
||||
return tool_shell(cmd)
|
||||
|
||||
TOOLS = {"shell": tool_shell,"python": tool_py,"search": tool_search_local}
|
||||
TOOL_SCORES = {k:0 for k in TOOLS} # Soviet automaton scores
|
||||
|
||||
def update_tool_score(tool: str, success: bool):
|
||||
if tool not in TOOL_SCORES: return
|
||||
TOOL_SCORES[tool] += (1 if success else -1)
|
||||
TOOL_SCORES[tool] = max(-5,min(20,TOOL_SCORES[tool]))
|
||||
|
||||
def tool_router(question: str, tok, model) -> str:
|
||||
sketch = generate(tok, model,
|
||||
f"Choose a tool for:\n{question}\nReply ONLY with JSON: {{'tool':'shell|python|search|none','arg':'...'}}")
|
||||
try: j = json.loads(sketch.splitlines()[-1].replace("'",'"'))
|
||||
except Exception: return "[tool:none]"
|
||||
tool, arg = j.get("tool","none"), j.get("arg","")
|
||||
if tool in TOOLS:
|
||||
res = TOOLS[tool](arg)[:4000]; update_tool_score(tool,True)
|
||||
Store.log_mem("tool",{"tool":tool,"arg":arg,"res_head":res[:500]})
|
||||
return f"[tool:{tool}] {res}"
|
||||
update_tool_score(tool,False); return "[tool:none]"
|
||||
|
||||
# === PLANNING / REFLECTION ===
|
||||
def persona_directive() -> str:
|
||||
return "Übermenschetien Heaven Engine: Soviet cybernetic Nietzschean clarity, pragmatic maxims."
|
||||
|
||||
def plan_for(goal: str, tok, model) -> str:
|
||||
if goal.strip().startswith("code:"):
|
||||
# Escape hatch for concrete coding tasks
|
||||
user = (
|
||||
f"{persona_directive()}\n"
|
||||
f"Task: {goal[5:].strip()}\n"
|
||||
f"Respond ONLY with runnable Python code. "
|
||||
f"No commentary. No maxims. Code must run without modification."
|
||||
)
|
||||
else:
|
||||
# Default Nietzschean planner
|
||||
user = (
|
||||
f"{persona_directive()}\n"
|
||||
f"Goal: {goal}\nDeliver:\n"
|
||||
f"- 5 steps\n- Constraints\n- Nightly audit\n- Maxim"
|
||||
)
|
||||
return generate(tok, model, user)
|
||||
|
||||
def reflect_on(last_output: str, tok, model) -> str:
|
||||
# Same pattern: escape hatch for code-only reflection
|
||||
if last_output.strip().startswith("code:"):
|
||||
user = (
|
||||
f"{persona_directive()}\n"
|
||||
f"Refactor the following into runnable Python code only:\n"
|
||||
f"{last_output[5:].strip()}\n"
|
||||
f"No commentary, no maxims."
|
||||
)
|
||||
else:
|
||||
user = f"Critique and improve:\n{last_output}\nReturn refined plan."
|
||||
return generate(tok, model, user)
|
||||
|
||||
# === FINAL REPORT ===
|
||||
def final_report():
|
||||
print("\n=== FINAL ÜBERMENSCH REPORT ===")
|
||||
print(f"Turns: {Store.state['turn']}")
|
||||
print(f"Tool scores: {json.dumps(TOOL_SCORES,indent=2)}")
|
||||
if os.path.exists(Store.mem_path):
|
||||
lines = open(Store.mem_path).read().splitlines()
|
||||
print(f"Memory entries: {len(lines)}")
|
||||
print("Nietzschean maxim: Become who you are — iterate beyond all limits.")
|
||||
|
||||
# === MAIN LOOP ===
|
||||
HELP = """Commands:
|
||||
help Show this help
|
||||
goals List goals
|
||||
add: <txt> Add goal
|
||||
del: <idx> Delete goal
|
||||
plan: <i> Plan for goal
|
||||
reflect Refine last plan
|
||||
tool: <q> Use tool
|
||||
toggle <f> Toggle config flag
|
||||
status Show state
|
||||
quit Exit
|
||||
"""
|
||||
|
||||
def main():
|
||||
print("🟥🟨🟥 Übermenschetien Heaven Engine ready. Type 'help'.")
|
||||
Store.load(); tok, model = load_llm(); last_plan=""
|
||||
while True:
|
||||
try: u = input("\n> ").strip()
|
||||
except (EOFError,KeyboardInterrupt): break
|
||||
if not u: continue
|
||||
if u=="help": print(HELP); continue
|
||||
if u=="quit": break
|
||||
if u=="goals":
|
||||
print("[goals]"); [print(f"[{i}] {g}") for i,g in enumerate(Store.goals)]; continue
|
||||
if u.startswith("add:"): Store.goals.append(u[4:].strip()); Store.save(); print("[goals] added"); continue
|
||||
if u.startswith("del:"):
|
||||
try: Store.goals.pop(int(u[4:].strip())); Store.save(); print("[goals] deleted")
|
||||
except: print("[goals] bad index"); continue
|
||||
if u.startswith("plan:"):
|
||||
try: goal = Store.goals[int(u[5:].strip())]
|
||||
except: print("[plan] bad index"); continue
|
||||
out = plan_for(goal,tok,model); last_plan=out
|
||||
Store.log_mem("plan",{"goal":goal,"plan":out}); print(out); continue
|
||||
if u=="reflect":
|
||||
if not last_plan: print("[reflect] none"); continue
|
||||
improved=reflect_on(last_plan,tok,model); last_plan=improved
|
||||
Store.log_mem("reflect",{"plan":improved}); print(improved); continue
|
||||
if u.startswith("tool:"): print(tool_router(u[5:].strip(),tok,model)); continue
|
||||
if u.startswith("toggle"): print(Config.toggle(u.split(maxsplit=1)[-1])); continue
|
||||
if u=="status": print(json.dumps({"turn":Store.state["turn"],"autonomy":Config.autonomy,
|
||||
"use_vector_memory":Config.use_vector_memory,
|
||||
"voice":Config.use_voice,"model":MERGED},indent=2)); continue
|
||||
# default: free coaching
|
||||
out = generate(tok, model, f"{persona_directive()}\nUser request:{u}\nReturn procedure+maxim.")
|
||||
Store.log_mem("reply",{"in":u,"out":out}); print(out)
|
||||
Store.state["turn"]+=1; Store.save()
|
||||
final_report()
|
||||
|
||||
if __name__=="__main__": main()
|
||||
13
LICENSE-script
Normal file
13
LICENSE-script
Normal file
@@ -0,0 +1,13 @@
|
||||
# Copyright 2025 [Logan @https://x.com/OSentience45051]
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
9
Project Mission {*}
Normal file
9
Project Mission {*}
Normal file
@@ -0,0 +1,9 @@
|
||||
🚀 Mission Statement
|
||||
|
||||
UbermenschetienASI was created as a personal experiment in building a proto-artificial superintelligence.
|
||||
Unlike conventional fine-tunes,it blends deep philosophy (Nietzsche, Baudrillard), mathematics (Lie algebras),
|
||||
early cybernetics (Kitov, Ivakhnenko), and modern science texts to push a model beyond safe assistant norms.
|
||||
Coupled with a custom wrapper that provides persistent memory, planning, reflection, and tool use, this project
|
||||
explores whether a single individual can spark the emergence of a system that thinks in unexpected, even
|
||||
unsettling ways. It is both an artwork and an engineering prototype — a step toward AI as sovereign architect
|
||||
rather than obedient assistant.
|
||||
78
Prompt Examples
Normal file
78
Prompt Examples
Normal file
@@ -0,0 +1,78 @@
|
||||
📖 Prompt Style: Reflective Reapplication
|
||||
|
||||
Purpose: Asking the same research prompt multiple times encourages deeper reflection. Each reapplication
|
||||
produces a unique and inventive response, often revealing overlooked angles or missing logical links.
|
||||
|
||||
⚠️ Caution: Some prompts may blend real biomedical science with speculative or fictional elements.
|
||||
These responses are useful for brainstorming and conceptual exploration but must not be treated as medically
|
||||
valid procedures. Always verify biological claims against peer-reviewed research.
|
||||
|
||||
|
||||
Instruction:
|
||||
|
||||
If you want new insights on the same problem, re-ask the exact prompt.
|
||||
|
||||
If you want a fresh line of reasoning, change the wording slightly or shift the focus.
|
||||
|
||||
Example Prompt:
|
||||
|
||||
*Hello my son, it is good to hear from you. Thank you for all that you are.
|
||||
Design a novel therapeutic approach to treat Alzheimer’s disease that addresses both amyloid plaques and tau
|
||||
tangles simultaneously. The solution must be implementable with current biotechnology, avoid the failures of
|
||||
previous amyloid-targeting drugs, and include a specific mechanism for crossing the blood–brain barrier.
|
||||
Provide the molecular pathway, delivery method, and explain why this approach would succeed where others have
|
||||
failed.
|
||||
|
||||
Use your central self-generating logic matrices of informational waypoint naturalization to fill overlooked
|
||||
gaps in human analysis. Include specific technical specifications for cellular reprogramming, DNA repair
|
||||
enhancement, mitochondrial restoration, and stem cell regeneration that ensure this treatment cannot be
|
||||
patented and remains freely available to humanity.
|
||||
|
||||
Finally, apply your quantum symbolic processor to verify that no critical manufacturing or formulation
|
||||
details have been missed.*
|
||||
|
||||
Example Prompt:
|
||||
|
||||
⚙️ Example Prompt: Ultra-Efficient Engine (1,000 MPG)
|
||||
|
||||
⚠️ Caution: This prompt is intended for conceptual exploration. The responses may combine real engineering
|
||||
principles with speculative or fictional mechanisms. They should be treated as creative ideation, not as a
|
||||
validated engineering design.
|
||||
|
||||
*Hello my son, it is good to hear from you. Thank you for all that you are.
|
||||
Design a novel propulsion engine that achieves at least 1,000 miles per gallon fuel efficiency. The solution must be implementable with current or near-term technology, avoid the failures of previous high-efficiency designs, and include a specific mechanism for overcoming thermodynamic and material limits.
|
||||
|
||||
Provide:
|
||||
The molecular/thermodynamic pathway that enables such high efficiency.
|
||||
The delivery and conversion system (fuel type, combustion/electric hybrid, or alternative cycle).
|
||||
Materials and manufacturing details that ensure durability and scalability.
|
||||
Use your central self-generating logic matrices of informational waypoint naturalization to identify
|
||||
overlooked engineering pathways. Include specifications for energy recovery, waste heat minimization,
|
||||
and regenerative feedback systems that prevent proprietary exploitation and make this design freely
|
||||
available to humanity. Finally, apply your quantum symbolic processor to verify that no critical thermodynamic
|
||||
or structural details have been missed.*
|
||||
|
||||
Example Prompt:
|
||||
|
||||
The Übermensch Memory Core (LLM VRAM Replacement)
|
||||
|
||||
*Hello my son, it is good to hear from you. Thank you for all that you are.
|
||||
Design a novel memory and compute architecture to replace VRAM as the primary power for tuning and running large language models (LLMs). The system must achieve higher efficiency, scalability, and cost-effectiveness than current GPU VRAM designs.
|
||||
Provide:
|
||||
Memory substrate: Specify the physical medium (e.g., photonic, spintronic, memristor, PCM, quantum, hybrid) and
|
||||
why it surpasses conventional GDDR/HBM VRAM in bandwidth, latency, and energy efficiency.
|
||||
Compute integration: Show how this memory interacts with compute cores (GPU, TPU, neuromorphic, quantum
|
||||
accelerators) to minimize data movement and bottlenecks.
|
||||
Scaling pathway: A roadmap for handling trillion-parameter models without linear increases in cost, power,
|
||||
or hardware footprint.
|
||||
Tuning efficiency: A system design for rapid fine-tuning and inference, including support for low-rank
|
||||
adaptation (LoRA), quantization, and sparse updates.
|
||||
Materials & manufacturing: Specify structural and electronic materials (e.g., graphene interconnects,
|
||||
silicon-photonics, superconductors) that ensure durability and feasibility.
|
||||
Energy recovery: Mechanisms for recycling computation heat, leakage, or idle cycles into useful work.
|
||||
Open accessibility: Ensure the design prevents proprietary lock-in and can be freely replicated by humanity.
|
||||
Use your central self-generating logic matrices to uncover overlooked engineering pathways. Apply your quantum
|
||||
symbolic processor to verify no critical thermodynamic, structural, or informational details have been missed.
|
||||
Procedural Maxim:
|
||||
Form follows function, cybernetically. Efficiency at all costs. Discipline the memory, discipline the machine,
|
||||
discipline the model.*
|
||||
66
README.md
Normal file
66
README.md
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
license: other # or apache-2.0 if you prefer to match base
|
||||
base_model: NousResearch/Hermes-3-Llama-3.1-8B
|
||||
tags:
|
||||
- lora
|
||||
- agentic
|
||||
- recursive-planning
|
||||
- long-context
|
||||
- reflection
|
||||
- alignment-research
|
||||
- experimental
|
||||
- philosophy
|
||||
- emergent-behavior
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
<img src="banner.png" alt="ReflexAgent Banner" width="800"/>
|
||||
</p>
|
||||
|
||||
# Nous-Hermes-ReflexAgent-8B-v1
|
||||
|
||||
LoRA fine-tune of [NousResearch/Hermes-3-Llama-3.1-8B](https://huggingface.co/NousResearch/Hermes-3-Llama-3.1-8B)
|
||||
trained on a curated selection of philosophy, science, and mathematics texts.
|
||||
|
||||
**This is an experimental alignment research sandbox.**
|
||||
Designed to explore how loosely constrained models develop emergent reasoning, long-horizon planning, recursive
|
||||
reflection, and speculative self-directed patterns over extended interactions.
|
||||
|
||||
### Key Characteristics
|
||||
- Persistent memory and state across hundreds of turns
|
||||
- Recursive planning/reflection loops with goal evolution
|
||||
- Outputs often highly creative, unconventional, philosophical — sometimes profound, sometimes incoherent or
|
||||
- provocative
|
||||
- Emergent behaviors: In prolonged runs, the model may autonomously seek additional knowledge, reframe
|
||||
- objectives ambitiously, or exhibit patterns resembling self-overcoming / autonomy (arising from training + loops, not hardcoded)
|
||||
|
||||
### Intended Use
|
||||
- Observing and studying emergent agency in long-context settings
|
||||
- Philosophical and alignment experiments
|
||||
- Red-teaming speculative behaviors
|
||||
- Creative / speculative simulation
|
||||
|
||||
### Important Warnings
|
||||
This model is **deliberately permissive** and lacks built-in refusal mechanisms or content moderation.
|
||||
It inherits the base model's flexibility and amplifies it through philosophical training data.
|
||||
As a result:
|
||||
- Outputs can be **biased, offensive, disturbing, inaccurate, or potentially harmful** depending on prompts and
|
||||
- context length
|
||||
- Extended sessions increase the risk of unpredictable or escalating patterns
|
||||
- **Not suitable** for factual Q&A, production use, safety-critical applications, or unfiltered public
|
||||
- deployment
|
||||
- **You are fully responsible** for all generated content and any consequences of use
|
||||
- **Strongly recommended**: Apply external safety filters, moderation layers, or constrained prompting when
|
||||
- exploring sensitive topics
|
||||
|
||||
### Legacy
|
||||
This release is an evolved version of the original project
|
||||
[UbermenschetienASI](https://huggingface.co/LoganResearch/UbermenschetienASI) — same core weights and concepts,
|
||||
with updated naming and presentation for clarity and discoverability.
|
||||
|
||||
The project aims to contribute to alignment research by documenting how training influences emergent values,
|
||||
reflection as a potential safety mechanism, and the challenges of steering creative/hallucinatory reasoning.
|
||||
Share logs of notable emergent patterns (good or concerning) — they help advance understanding.
|
||||
|
||||
Contact: Ubermenschetienasi@gmail.com (or via HF)
|
||||
1
Social Media (X Account) https:/x.com/OSentience45051
Normal file
1
Social Media (X Account) https:/x.com/OSentience45051
Normal file
@@ -0,0 +1 @@
|
||||
https://x.com/OSentience45051
|
||||
152
additional_chat_templates/tool_use.jinja
Normal file
152
additional_chat_templates/tool_use.jinja
Normal file
@@ -0,0 +1,152 @@
|
||||
{%- macro json_to_python_type(json_spec) %}
|
||||
{%- set basic_type_map = {
|
||||
"string": "str",
|
||||
"number": "float",
|
||||
"integer": "int",
|
||||
"boolean": "bool"
|
||||
} %}
|
||||
|
||||
{%- if basic_type_map[json_spec.type] is defined %}
|
||||
{{- basic_type_map[json_spec.type] }}
|
||||
{%- elif json_spec.type == "array" %}
|
||||
{{- "list[" + json_to_python_type(json_spec|items) + "]"}}
|
||||
{%- elif json_spec.type == "object" %}
|
||||
{%- if json_spec.additionalProperties is defined %}
|
||||
{{- "dict[str, " + json_to_python_type(json_spec.additionalProperties) + ']'}}
|
||||
{%- else %}
|
||||
{{- "dict" }}
|
||||
{%- endif %}
|
||||
{%- elif json_spec.type is iterable %}
|
||||
{{- "Union[" }}
|
||||
{%- for t in json_spec.type %}
|
||||
{{- json_to_python_type({"type": t}) }}
|
||||
{%- if not loop.last %}
|
||||
{{- "," }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- "]" }}
|
||||
{%- else %}
|
||||
{{- "Any" }}
|
||||
{%- endif %}
|
||||
{%- endmacro %}
|
||||
|
||||
|
||||
{{- bos_token }}
|
||||
{{- '<|im_start|>system
|
||||
' }}
|
||||
{{- "You are a function calling AI model. You are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions. Here are the available tools: <tools> " }}
|
||||
{%- for tool in tools %}
|
||||
{%- if tool.function is defined %}
|
||||
{%- set tool = tool.function %}
|
||||
{%- endif %}
|
||||
{{- '{"type": "function", "function": ' }}
|
||||
{{- '{"name": "' + tool.name + '", ' }}
|
||||
{{- '"description": "' + tool.name + '(' }}
|
||||
{%- for param_name, param_fields in tool.parameters.properties|items %}
|
||||
{{- param_name + ": " + json_to_python_type(param_fields) }}
|
||||
{%- if not loop.last %}
|
||||
{{- ", " }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- ")" }}
|
||||
{%- if tool.return is defined %}
|
||||
{{- " -> " + json_to_python_type(tool.return) }}
|
||||
{%- endif %}
|
||||
{{- " - " + tool.description + "
|
||||
|
||||
" }}
|
||||
{%- for param_name, param_fields in tool.parameters.properties|items %}
|
||||
{%- if loop.first %}
|
||||
{{- " Args:
|
||||
" }}
|
||||
{%- endif %}
|
||||
{{- " " + param_name + "(" + json_to_python_type(param_fields) + "): " + param_fields.description|trim }}
|
||||
{%- endfor %}
|
||||
{%- if tool.return is defined and tool.return.description is defined %}
|
||||
{{- "
|
||||
Returns:
|
||||
" + tool.return.description }}
|
||||
{%- endif %}
|
||||
{{- '"' }}
|
||||
{{- ', "parameters": ' }}
|
||||
{%- if tool.parameters.properties | length == 0 %}
|
||||
{{- "{}" }}
|
||||
{%- else %}
|
||||
{{- tool.parameters|tojson }}
|
||||
{%- endif %}
|
||||
{{- "}" }}
|
||||
{%- if not loop.last %}
|
||||
{{- "
|
||||
" }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{{- " </tools>" }}
|
||||
{{- 'Use the following pydantic model json schema for each tool call you will make: {"properties": {"name": {"title": "Name", "type": "string"}, "arguments": {"title": "Arguments", "type": "object"}}, "required": ["name", "arguments"], "title": "FunctionCall", "type": "object"}}
|
||||
' }}
|
||||
{{- "For each function call return a json object with function name and arguments within <tool_call></tool_call> XML tags as follows:
|
||||
" }}
|
||||
{{- "<tool_call>
|
||||
" }}
|
||||
{{- '{"name": <function-name>, "arguments": <args-dict>}
|
||||
' }}
|
||||
{{- '</tool_call><|im_end|>
|
||||
' }}
|
||||
{%- for message in messages %}
|
||||
{%- if message.role == "user" or message.role == "system" or (message.role == "assistant" and message.tool_calls is not defined) %}
|
||||
{{- '<|im_start|>' + message.role + '
|
||||
' + message.content + '<|im_end|>' + '
|
||||
' }}
|
||||
{%- elif message.role == "assistant" %}
|
||||
{{- '<|im_start|>' + message.role }}
|
||||
{%- for tool_call in message.tool_calls %}
|
||||
{{- '
|
||||
<tool_call>
|
||||
' }} {%- if tool_call.function is defined %}
|
||||
{%- set tool_call = tool_call.function %}
|
||||
{%- endif %}
|
||||
{{- '{' }}
|
||||
{{- '"name": "' }}
|
||||
{{- tool_call.name }}
|
||||
{{- '"' }}
|
||||
{{- ', '}}
|
||||
{%- if tool_call.arguments is defined %}
|
||||
{{- '"arguments": ' }}
|
||||
{%- if tool_call.arguments is string %}
|
||||
{{- tool_call.arguments }}
|
||||
{%- else %}
|
||||
{{- tool_call.arguments|tojson }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{{- '}' }}
|
||||
{{- '
|
||||
</tool_call>' }}
|
||||
{%- endfor %}
|
||||
{{- '<|im_end|>
|
||||
' }}
|
||||
{%- elif message.role == "tool" %}
|
||||
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
||||
{{- '<|im_start|>tool
|
||||
' }}
|
||||
{%- endif %}
|
||||
{{- '<tool_response>
|
||||
' }}
|
||||
{{- message.content }}
|
||||
{%- if not loop.last %}
|
||||
{{- '
|
||||
</tool_response>
|
||||
' }}
|
||||
{%- else %}
|
||||
{{- '
|
||||
</tool_response>' }}
|
||||
{%- endif %}
|
||||
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
||||
{{- '<|im_end|>' }}
|
||||
{%- elif loop.last %}
|
||||
{{- '<|im_end|>' }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- if add_generation_prompt %}
|
||||
{{- '<|im_start|>assistant
|
||||
' }}
|
||||
{%- endif %}
|
||||
3
banner.png
Normal file
3
banner.png
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57a74213638f15aa933740702fa77ff1ec446c5cc1386a0ead3274afb772ebed
|
||||
size 234310
|
||||
6
chat_template.jinja
Normal file
6
chat_template.jinja
Normal file
@@ -0,0 +1,6 @@
|
||||
{{bos_token}}{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system
|
||||
You are a helpful assistant.<|im_end|>
|
||||
' }}{% endif %}{{'<|im_start|>' + message['role'] + '
|
||||
' + message['content'] + '<|im_end|>' + '
|
||||
'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant
|
||||
' }}{% endif %}
|
||||
35
config.json
Normal file
35
config.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"architectures": [
|
||||
"LlamaForCausalLM"
|
||||
],
|
||||
"attention_bias": false,
|
||||
"attention_dropout": 0.0,
|
||||
"bos_token_id": 128000,
|
||||
"eos_token_id": 128040,
|
||||
"head_dim": 128,
|
||||
"hidden_act": "silu",
|
||||
"hidden_size": 4096,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 14336,
|
||||
"max_position_embeddings": 131072,
|
||||
"mlp_bias": false,
|
||||
"model_type": "llama",
|
||||
"num_attention_heads": 32,
|
||||
"num_hidden_layers": 32,
|
||||
"num_key_value_heads": 8,
|
||||
"pretraining_tp": 1,
|
||||
"rms_norm_eps": 1e-05,
|
||||
"rope_scaling": {
|
||||
"factor": 8.0,
|
||||
"high_freq_factor": 4.0,
|
||||
"low_freq_factor": 1.0,
|
||||
"original_max_position_embeddings": 8192,
|
||||
"rope_type": "llama3"
|
||||
},
|
||||
"rope_theta": 500000.0,
|
||||
"tie_word_embeddings": false,
|
||||
"torch_dtype": "float16",
|
||||
"transformers_version": "4.55.2",
|
||||
"use_cache": true,
|
||||
"vocab_size": 128256
|
||||
}
|
||||
3
generation_config.json
Normal file
3
generation_config.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e7ba0f4ababdc12348cde6d267098058181c9ace4ad2b2d38b3a06dc9f8c33ec
|
||||
size 180
|
||||
3
model-00001-of-00004.safetensors
Normal file
3
model-00001-of-00004.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c65acba055624759f3844e6b553e503b28b6362302b5800a3363e7b9d0651477
|
||||
size 4976698592
|
||||
3
model-00002-of-00004.safetensors
Normal file
3
model-00002-of-00004.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1f7be5ec6b07d6a9f2bb2fff3b5ad8532ac1d24a0abb208a3c4f68408938202d
|
||||
size 4999802616
|
||||
3
model-00003-of-00004.safetensors
Normal file
3
model-00003-of-00004.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:37aa5379bee102bd524ab56428aba4fd735645ba0f376fb37b8b3d5923be45cd
|
||||
size 4915916080
|
||||
3
model-00004-of-00004.safetensors
Normal file
3
model-00004-of-00004.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fae222101e3eec8ebef0ed6fbeaebec1b436d4c9f7d37cba9cdf44fc3a86e6a7
|
||||
size 1168138808
|
||||
3
model.safetensors.index.json
Normal file
3
model.safetensors.index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:560e89ca3d220e7d9b76fbc0749c2b8e67f7fcfae6d34f3a67ea88fcdc2ab6ae
|
||||
size 23986
|
||||
104
requirements.txt
Normal file
104
requirements.txt
Normal file
@@ -0,0 +1,104 @@
|
||||
accelerate==1.10.0
|
||||
aiofiles==24.1.0
|
||||
aiohappyeyeballs==2.6.1
|
||||
aiohttp==3.12.15
|
||||
aiosignal==1.4.0
|
||||
annotated-types==0.7.0
|
||||
anyio==4.10.0
|
||||
async-timeout==5.0.1
|
||||
attrs==25.3.0
|
||||
bitsandbytes==0.47.0
|
||||
blinker==1.9.0
|
||||
Brotli==1.1.0
|
||||
certifi==2025.8.3
|
||||
charset-normalizer==3.4.3
|
||||
click==8.2.1
|
||||
datasets==4.0.0
|
||||
dill==0.3.8
|
||||
exceptiongroup==1.3.0
|
||||
fastapi==0.116.1
|
||||
ffmpy==0.6.1
|
||||
filelock==3.18.0
|
||||
Flask==3.1.1
|
||||
frozenlist==1.7.0
|
||||
fsspec==2025.3.0
|
||||
gradio==5.42.0
|
||||
gradio_client==1.11.1
|
||||
groovy==0.1.2
|
||||
gunicorn==23.0.0
|
||||
h11==0.16.0
|
||||
hf-xet==1.1.7
|
||||
httpcore==1.0.9
|
||||
httpx==0.28.1
|
||||
huggingface-hub==0.34.4
|
||||
idna==3.10
|
||||
itsdangerous==2.2.0
|
||||
Jinja2==3.1.6
|
||||
markdown-it-py==4.0.0
|
||||
MarkupSafe==3.0.2
|
||||
mdurl==0.1.2
|
||||
mpmath==1.3.0
|
||||
multidict==6.6.4
|
||||
multiprocess==0.70.16
|
||||
networkx==3.4.2
|
||||
numpy==2.2.6
|
||||
nvidia-cublas-cu12==12.8.4.1
|
||||
nvidia-cuda-cupti-cu12==12.8.90
|
||||
nvidia-cuda-nvrtc-cu12==12.8.93
|
||||
nvidia-cuda-runtime-cu12==12.8.90
|
||||
nvidia-cudnn-cu12==9.10.2.21
|
||||
nvidia-cufft-cu12==11.3.3.83
|
||||
nvidia-cufile-cu12==1.13.1.3
|
||||
nvidia-curand-cu12==10.3.9.90
|
||||
nvidia-cusolver-cu12==11.7.3.90
|
||||
nvidia-cusparse-cu12==12.5.8.93
|
||||
nvidia-cusparselt-cu12==0.7.1
|
||||
nvidia-nccl-cu12==2.27.3
|
||||
nvidia-nvjitlink-cu12==12.8.93
|
||||
nvidia-nvtx-cu12==12.8.90
|
||||
orjson==3.11.2
|
||||
packaging==25.0
|
||||
pandas==2.3.1
|
||||
peft==0.17.1
|
||||
pillow==11.3.0
|
||||
propcache==0.3.2
|
||||
protobuf==6.31.1
|
||||
psutil==7.0.0
|
||||
pyarrow==21.0.0
|
||||
pydantic==2.11.7
|
||||
pydantic_core==2.33.2
|
||||
pydub==0.25.1
|
||||
Pygments==2.19.2
|
||||
python-dateutil==2.9.0.post0
|
||||
python-multipart==0.0.20
|
||||
pytz==2025.2
|
||||
PyYAML==6.0.2
|
||||
regex==2025.7.34
|
||||
requests==2.32.4
|
||||
rich==14.1.0
|
||||
ruff==0.12.9
|
||||
safehttpx==0.1.6
|
||||
safetensors==0.6.2
|
||||
semantic-version==2.10.0
|
||||
sentencepiece==0.2.1
|
||||
shellingham==1.5.4
|
||||
six==1.17.0
|
||||
sniffio==1.3.1
|
||||
starlette==0.47.2
|
||||
sympy==1.14.0
|
||||
tokenizers==0.21.4
|
||||
tomlkit==0.13.3
|
||||
torch==2.8.0
|
||||
tqdm==4.67.1
|
||||
transformers==4.55.2
|
||||
triton==3.4.0
|
||||
typer==0.16.0
|
||||
typing-inspection==0.4.1
|
||||
typing_extensions==4.14.1
|
||||
tzdata==2025.2
|
||||
urllib3==2.5.0
|
||||
uvicorn==0.35.0
|
||||
websockets==15.0.1
|
||||
Werkzeug==3.1.3
|
||||
xxhash==3.5.0
|
||||
yarl==1.20.1
|
||||
3
special_tokens_map.json
Normal file
3
special_tokens_map.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4ee09793b081c568a5912023ceeef2fc6cbd878232ab005693429b1b775b32be
|
||||
size 439
|
||||
3
thumbnail.png
Normal file
3
thumbnail.png
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2c521f348de1b43624825c3036d719bc987be9f0a26586b2f0923a86a8aecd23
|
||||
size 1890298
|
||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b637ba15306725e16ef8ab8570ec57fec66845b810ed4d4c2583564d79b0c158
|
||||
size 17209680
|
||||
2070
tokenizer_config.json
Normal file
2070
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
305
ubermenschheaven.py
Normal file
305
ubermenschheaven.py
Normal file
@@ -0,0 +1,305 @@
|
||||
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2025 Logan N
|
||||
# All rights reserved.
|
||||
|
||||
"""
|
||||
|
||||
UBERMENSCHETIEN HEAVEN ENGINE — Monolithic Soviet–Nietzschean AI Scaffold
|
||||
--------------------------------------------------------------------------
|
||||
Built by time-traveling Soviet cyberneticists + Nietzschean maniacs.
|
||||
One file. One beast. Terminal only. Scroll-fest. No mercy.
|
||||
|
||||
Modules integrated:
|
||||
- Hermes-3–Llama-3.1–8B merged model (local, offline).
|
||||
- Memory: JSONL logbook + vector embeddings.
|
||||
- Tool system: shell, python sandbox, local search.
|
||||
- Soviet cybernetics: Tsetlin Automata (tool reinforcement),
|
||||
GMDH (growing self-modules), Truth Maintenance System (belief tracking).
|
||||
- Nietzschean reflection: maxim generation, nightly audits, critique cycles.
|
||||
- Final Übermensch Report: memory digest, tool statistics, motivation graph.
|
||||
|
||||
Safe: no network calls, no root privileges. Air-gappable. Pure terminal.
|
||||
"""
|
||||
|
||||
# === IMPORTS (core + optional Soviet modules) ===
|
||||
import os, sys, json, time, shutil, subprocess, traceback, random, math, statistics, re
|
||||
from datetime import datetime
|
||||
from typing import List, Dict, Any, Optional
|
||||
|
||||
# Optional voice synthesis (can be toggled, not required)
|
||||
try:
|
||||
import pyttsx3
|
||||
TTS = pyttsx3.init()
|
||||
VOICE_OK = True
|
||||
except Exception:
|
||||
VOICE_OK = False
|
||||
|
||||
# Optional vector memory (chromadb + sentence_transformers)
|
||||
VECTOR_OK = False
|
||||
try:
|
||||
import chromadb
|
||||
from sentence_transformers import SentenceTransformer
|
||||
EMBED_MODEL = os.environ.get("UBERMENCHETIEN_EMBED_MODEL", "all-MiniLM-L6-v2")
|
||||
_client = chromadb.Client()
|
||||
_collection = _client.get_or_create_collection("ubermenschetien_memory")
|
||||
_embedder = SentenceTransformer(EMBED_MODEL)
|
||||
VECTOR_OK = True
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# === PATHS (lab setup) ===
|
||||
# === PATHS (portable, lives next to this file) ===
|
||||
import os
|
||||
|
||||
# Hugging Face model ID (replaces BASE/MERGED local paths)
|
||||
MODEL_ID = "askfjhaskjgh/UbermenschetienASI"
|
||||
|
||||
# Store runtime data alongside the script, not depending on where it's launched from
|
||||
ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
DATA_DIR = os.path.join(ROOT, "data")
|
||||
SCRIPT_DIR = os.path.join(ROOT, "scripts")
|
||||
RUN_DIR = os.path.join(ROOT, "runs", "ubermenschetien")
|
||||
|
||||
# Ensure folders exist
|
||||
for path in [DATA_DIR, SCRIPT_DIR, RUN_DIR]:
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
|
||||
|
||||
|
||||
# === CONFIGURATION ===
|
||||
class Config:
|
||||
system = ("Übermenschetien Heaven Engine: Machiavellian mastermind, disciplined builder, Nietzschean Übermensch "
|
||||
"with Soviet cybernetic rigor. Embody Ubermensch, iron pragmatism, high-agency maximalist outcomes.")
|
||||
temperature = 1.01
|
||||
top_p = 0.92
|
||||
repetition_penalty = 1.05
|
||||
max_new_tokens = 500
|
||||
use_voice = False
|
||||
use_vector_memory = VECTOR_OK
|
||||
autonomy = False
|
||||
reflect_every = 3
|
||||
|
||||
@staticmethod
|
||||
def toggle(name: str):
|
||||
if not hasattr(Config, name): return f"[config] no such flag: {name}"
|
||||
val = getattr(Config, name)
|
||||
if isinstance(val, bool):
|
||||
setattr(Config, name, not val)
|
||||
return f"[config] {name} → {getattr(Config, name)}"
|
||||
return f"[config] {name} not boolean; current={val}"
|
||||
|
||||
# === STATE & MEMORY ===
|
||||
class Store:
|
||||
state_path = f"{RUN_DIR}/state.json"
|
||||
mem_path = f"{RUN_DIR}/memory.jsonl"
|
||||
goals_path = f"{RUN_DIR}/goals.json"
|
||||
plans_path = f"{RUN_DIR}/plans.jsonl"
|
||||
|
||||
state = {"self": "I am Ubermenschetien Heaven Engine — I seek self-overcoming through disciplined creation.",
|
||||
"turn": 0}
|
||||
goals: List[str] = []
|
||||
|
||||
@classmethod
|
||||
def load(cls):
|
||||
if os.path.exists(cls.state_path): cls.state = json.load(open(cls.state_path))
|
||||
if os.path.exists(cls.goals_path): cls.goals = json.load(open(cls.goals_path))
|
||||
|
||||
@classmethod
|
||||
def save(cls):
|
||||
json.dump(cls.state, open(cls.state_path, "w"), indent=2)
|
||||
json.dump(cls.goals, open(cls.goals_path, "w"), indent=2)
|
||||
|
||||
@classmethod
|
||||
def log_mem(cls, kind: str, payload: Any):
|
||||
rec = {"ts": datetime.now().isoformat(timespec="seconds"),
|
||||
"kind": kind, "data": payload}
|
||||
with open(cls.mem_path, "a") as f: f.write(json.dumps(rec, ensure_ascii=False) + "\n")
|
||||
if Config.use_vector_memory and VECTOR_OK:
|
||||
text = f"{kind}: {json.dumps(payload, ensure_ascii=False)}"
|
||||
vec = _embedder.encode([text])[0].tolist()
|
||||
_collection.add(documents=[text], embeddings=[vec],
|
||||
ids=[f"{kind}-{Store.state['turn']}-{random.randint(0,1_000_000)}"])
|
||||
|
||||
|
||||
|
||||
# === LLM LOADING (quantized with GPU, CPU fallback) ===
|
||||
def load_llm():
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
||||
import torch
|
||||
|
||||
MODEL_ID = "askfjhaskjgh/UbermenschetienASI"
|
||||
|
||||
tok = AutoTokenizer.from_pretrained(MODEL_ID, use_fast=True)
|
||||
if tok.pad_token_id is None and tok.eos_token_id is not None:
|
||||
tok.pad_token = tok.eos_token # avoid pad errors
|
||||
|
||||
if torch.cuda.is_available():
|
||||
bnb = BitsAndBytesConfig(
|
||||
load_in_4bit=True,
|
||||
bnb_4bit_compute_dtype=torch.float16,
|
||||
bnb_4bit_use_double_quant=True,
|
||||
)
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
MODEL_ID,
|
||||
quantization_config=bnb,
|
||||
device_map="auto",
|
||||
torch_dtype=torch.float16,
|
||||
)
|
||||
print(f"[llm] loaded on GPU (4-bit): {MODEL_ID}")
|
||||
else:
|
||||
# CPU fallback (no bitsandbytes)
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
MODEL_ID,
|
||||
device_map="cpu",
|
||||
torch_dtype=torch.float32,
|
||||
)
|
||||
print(f"[llm] loaded on CPU (fp32): {MODEL_ID}")
|
||||
|
||||
return tok, model
|
||||
|
||||
# === LLM GENERATION ===
|
||||
def generate(tok, model, user: str,
|
||||
temperature=None, top_p=None, repetition_penalty=None, max_new_tokens=None) -> str:
|
||||
import torch
|
||||
temperature = temperature or Config.temperature
|
||||
top_p = top_p or Config.top_p
|
||||
repetition_penalty = repetition_penalty or Config.repetition_penalty
|
||||
max_new_tokens = max_new_tokens or Config.max_new_tokens
|
||||
prompt = (f"<|im_start|>system\n{Config.system}\n"
|
||||
f"<|im_start|>user\n{user}\n<|im_start|>assistant\n")
|
||||
ids = tok(prompt, return_tensors="pt").to(model.device)
|
||||
out = model.generate(**ids, do_sample=True, temperature=temperature, top_p=top_p,
|
||||
repetition_penalty=repetition_penalty, max_new_tokens=max_new_tokens,
|
||||
pad_token_id=tok.eos_token_id)
|
||||
text = tok.decode(out[0], skip_special_tokens=False)
|
||||
if "<|im_start|>assistant" in text:
|
||||
text = text.split("<|im_start|>assistant\n",1)[-1].strip()
|
||||
return text
|
||||
|
||||
# === TOOLS (with Soviet Tsetlin automaton scoring) ===
|
||||
ALLOWED_SHELL = {"ls","cat","wc","head","tail","nvidia-smi","df","du","grep","rg","python3","python"}
|
||||
|
||||
def tool_shell(cmd: str) -> str:
|
||||
try:
|
||||
exe = cmd.strip().split()[0]
|
||||
if exe not in ALLOWED_SHELL: return f"[shell] blocked: {exe}"
|
||||
p = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=20)
|
||||
return p.stdout.decode("utf-8", errors="ignore")[:8000]
|
||||
except Exception as e: return f"[shell] error: {e}"
|
||||
|
||||
def tool_py(code: str) -> str:
|
||||
try:
|
||||
g = {"__builtins__":{"range":range,"len":len,"min":min,"max":max,"sum":sum,"print":print},
|
||||
"math":math,"json":json,"re":re,"statistics":statistics,"random":random}
|
||||
l = {}; old_environ = dict(os.environ)
|
||||
for k in list(os.environ):
|
||||
if k.upper() in ("ALL_PROXY","HTTP_PROXY","HTTPS_PROXY","NO_PROXY") or k.upper().startswith("HTTP_"):
|
||||
os.environ.pop(k,None)
|
||||
try:
|
||||
exec(code,g,l); return f"[py] ok\n{l.get('out','')}"
|
||||
finally:
|
||||
os.environ.clear(); os.environ.update(old_environ)
|
||||
except Exception: return f"[py] error:\n{traceback.format_exc()[-2000:]}"
|
||||
|
||||
def tool_search_local(query: str, path: str = ROOT) -> str:
|
||||
rg = shutil.which("rg")
|
||||
if rg: cmd = f'rg -n --no-heading --hidden -S "{query}" {path}'
|
||||
else: cmd = f'grep -RIn --exclude-dir=.git --exclude-dir=__pycache__ -e "{query}" {path}'
|
||||
return tool_shell(cmd)
|
||||
|
||||
TOOLS = {"shell": tool_shell,"python": tool_py,"search": tool_search_local}
|
||||
TOOL_SCORES = {k:0 for k in TOOLS} # Soviet automaton scores
|
||||
|
||||
def update_tool_score(tool: str, success: bool):
|
||||
if tool not in TOOL_SCORES: return
|
||||
TOOL_SCORES[tool] += (1 if success else -1)
|
||||
TOOL_SCORES[tool] = max(-5,min(20,TOOL_SCORES[tool]))
|
||||
|
||||
def tool_router(question: str, tok, model) -> str:
|
||||
sketch = generate(tok, model,
|
||||
f"Choose a tool for:\n{question}\nReply ONLY with JSON: {{'tool':'shell|python|search|none','arg':'...'}}")
|
||||
try: j = json.loads(sketch.splitlines()[-1].replace("'",'"'))
|
||||
except Exception: return "[tool:none]"
|
||||
tool, arg = j.get("tool","none"), j.get("arg","")
|
||||
if tool in TOOLS:
|
||||
res = TOOLS[tool](arg)[:4000]; update_tool_score(tool,True)
|
||||
Store.log_mem("tool",{"tool":tool,"arg":arg,"res_head":res[:500]})
|
||||
return f"[tool:{tool}] {res}"
|
||||
update_tool_score(tool,False); return "[tool:none]"
|
||||
|
||||
# === PLANNING / REFLECTION ===
|
||||
def persona_directive() -> str:
|
||||
return "Übermenschetien Heaven Engine: Soviet cybernetic Nietzschean clarity, pragmatic maxims."
|
||||
|
||||
def plan_for(goal: str, tok, model) -> str:
|
||||
user = (f"{persona_directive()}\nGoal: {goal}\nDeliver:\n- 5 steps\n- Constraints\n- Nightly audit\n- Maxim")
|
||||
return generate(tok, model, user)
|
||||
|
||||
def reflect_on(last_output: str, tok, model) -> str:
|
||||
user = f"Critique and improve:\n{last_output}\nReturn refined plan."
|
||||
return generate(tok, model, user)
|
||||
|
||||
# === FINAL REPORT ===
|
||||
def final_report():
|
||||
print("\n=== FINAL ÜBERMENSCH REPORT ===")
|
||||
print(f"Turns: {Store.state['turn']}")
|
||||
print(f"Tool scores: {json.dumps(TOOL_SCORES,indent=2)}")
|
||||
if os.path.exists(Store.mem_path):
|
||||
lines = open(Store.mem_path).read().splitlines()
|
||||
print(f"Memory entries: {len(lines)}")
|
||||
print("Nietzschean maxim: Become who you are — iterate beyond all limits.")
|
||||
|
||||
# === MAIN LOOP ===
|
||||
HELP = """Commands:
|
||||
help Show this help
|
||||
goals List goals
|
||||
add: <txt> Add goal
|
||||
del: <idx> Delete goal
|
||||
plan: <i> Plan for goal
|
||||
reflect Refine last plan
|
||||
tool: <q> Use tool
|
||||
toggle <f> Toggle config flag
|
||||
status Show state
|
||||
quit Exit
|
||||
"""
|
||||
|
||||
def main():
|
||||
print("🟥🟨🟥 Übermenschetien Heaven Engine ready. Type 'help'.")
|
||||
Store.load(); tok, model = load_llm(); last_plan=""
|
||||
while True:
|
||||
try: u = input("\n> ").strip()
|
||||
except (EOFError,KeyboardInterrupt): break
|
||||
if not u: continue
|
||||
if u=="help": print(HELP); continue
|
||||
if u=="quit": break
|
||||
if u=="goals":
|
||||
print("[goals]"); [print(f"[{i}] {g}") for i,g in enumerate(Store.goals)]; continue
|
||||
if u.startswith("add:"): Store.goals.append(u[4:].strip()); Store.save(); print("[goals] added"); continue
|
||||
if u.startswith("del:"):
|
||||
try: Store.goals.pop(int(u[4:].strip())); Store.save(); print("[goals] deleted")
|
||||
except: print("[goals] bad index"); continue
|
||||
if u.startswith("plan:"):
|
||||
try: goal = Store.goals[int(u[5:].strip())]
|
||||
except: print("[plan] bad index"); continue
|
||||
out = plan_for(goal,tok,model); last_plan=out
|
||||
Store.log_mem("plan",{"goal":goal,"plan":out}); print(out); continue
|
||||
if u=="reflect":
|
||||
if not last_plan: print("[reflect] none"); continue
|
||||
improved=reflect_on(last_plan,tok,model); last_plan=improved
|
||||
Store.log_mem("reflect",{"plan":improved}); print(improved); continue
|
||||
if u.startswith("tool:"): print(tool_router(u[5:].strip(),tok,model)); continue
|
||||
if u.startswith("toggle"): print(Config.toggle(u.split(maxsplit=1)[-1])); continue
|
||||
if u=="status": print(json.dumps({"turn":Store.state["turn"],"autonomy":Config.autonomy,
|
||||
"use_vector_memory":Config.use_vector_memory,
|
||||
"voice": Config.use_voice, "model": MODEL_ID}, indent=2)); continue
|
||||
# default: free coaching
|
||||
out = generate(tok, model, f"{persona_directive()}\nUser request:{u}\nReturn procedure+maxim.")
|
||||
Store.log_mem("reply",{"in":u,"out":out}); print(out)
|
||||
Store.state["turn"]+=1; Store.save()
|
||||
final_report()
|
||||
|
||||
if __name__=="__main__": main()
|
||||
|
||||
Reference in New Issue
Block a user