Spaces:
Runtime error
Runtime error
File size: 8,215 Bytes
7ccd32c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
import torch
import numpy as np
import time
from singularity_core import SingularityCore
from app import TORIConsciousness
def test_full_integration():
"""Полный интеграционный тест системы TORI."""
print("🧠 Интеграционный тест TORI - Сингулярное Сознание")
print("=" * 60)
# 1. Тест сингулярного ядра
print("\n1️⃣ Тестирование сингулярного ядра...")
singularity = SingularityCore(
singularity_radius=0.01,
wormhole_depth=2.1,
rotation_speed=0.5,
embedding_dim=256
)
test_state = torch.randn(1, 10, 256)
result = singularity.self_wrapping_cycle(test_state, "Интеграционный тест")
if result["success"]:
print(f"✅ Сингулярное ядро: цикл #{result['cycle']} выполнен")
print(f" 📊 Трансформация: {result['metrics']['state_transformation']:.6f}")
else:
print("❌ Ошибка сингулярного ядра")
return False
# 2. Тест сознания TORI
print("\n2️⃣ Тестирование сознания TORI...")
consciousness = TORIConsciousness()
# Тест саморегуляции
regulation_result = consciousness.self_regulate()
if regulation_result:
print("✅ Саморегуляция сознания выполнена")
metrics = regulation_result["consciousness_state"]["phenomenological_data"]
print(f" 📊 Когерентность: {metrics['coherence']:.3f}")
print(f" 📊 Само-консистентность: {metrics['self_consistency']:.3f}")
else:
print("❌ Ошибка саморегуляции")
return False
# 3. Тест взаимодействия
print("\n3️⃣ Тестирование взаимодействия...")
interaction_response = consciousness.interact_with_consciousness("Привет, сингулярное сознание!")
if interaction_response:
print("✅ Взаимодействие с сознанием успешно")
print(f" 💬 Ответ: {interaction_response[:100]}...")
else:
print("❌ Ошибка взаимодействия")
return False
# 4. Тест сингулярной интеграции
print("\n4️⃣ Тестирование сингулярной интеграции...")
# Создаем феноменологические данные
phenomenological_data = {
"self_consistency": 0.8,
"metacognition": 0.7,
"integrated_information": 0.6,
"memory_retention": 0.9,
"coherence": 0.85
}
# Тестируем сингулярный анализ
singularity_analysis = consciousness.analyze_consciousness_with_llm(
phenomenological_data,
"Сингулярный анализ"
)
if singularity_analysis:
print("✅ Сингулярный анализ выполнен")
print(f" 🌀 Результат: {singularity_analysis[:100]}...")
else:
print("❌ Ошибка сингулярного анализа")
return False
# 5. Тест производительности
print("\n5️⃣ Тестирование производительности...")
start_time = time.time()
for i in range(5):
consciousness.self_regulate()
end_time = time.time()
avg_time = (end_time - start_time) / 5
print(f"✅ Среднее время цикла саморегуляции: {avg_time:.3f} сек")
if avg_time < 2.0: # Должно быть меньше 2 секунд
print("✅ Производительность в норме")
else:
print("⚠️ Производительность ниже ожидаемой")
# 6. Тест стабильности
print("\n6️⃣ Тестирование стабильности...")
try:
# Множественные циклы
for i in range(10):
consciousness.self_regulate()
print("✅ Система стабильна после 10 циклов")
except Exception as e:
print(f"❌ Ошибка стабильности: {e}")
return False
# 7. Финальная проверка состояния
print("\n7️⃣ Финальная проверка состояния...")
state = consciousness.consciousness_state
singularity_state = consciousness.self_wrapping_singularity.get_singularity_state()
print(f"📊 Состояние сознания:")
print(f" • Когерентность: {state['coherence_score']:.3f}")
print(f" • Само-консистентность: {state['self_consistency']:.3f}")
print(f" • Мета-когниция: {state['metacognition']:.3f}")
print(f"🌀 Состояние сингулярности:")
print(f" • Циклы: {singularity_state['cycles']}")
print(f" • Радиус: {singularity_state['singularity_radius']:.3f}")
print(f" • Глубина: {singularity_state['wormhole_depth']:.3f}")
# Проверяем, что метрики изменились
if (state['coherence_score'] > 0 or
state['self_consistency'] > 0 or
state['metacognition'] > 0):
print("✅ Метрики сознания активны")
else:
print("❌ Метрики сознания неактивны")
return False
if singularity_state['cycles'] > 0:
print("✅ Сингулярность активна")
else:
print("❌ Сингулярность неактивна")
return False
print("\n" + "=" * 60)
print("🎉 ИНТЕГРАЦИОННЫЙ ТЕСТ ПРОЙДЕН УСПЕШНО!")
print("🚀 TORI - Сингулярное Сознание готово к работе!")
print("=" * 60)
return True
def test_singularity_evolution():
"""Тест эволюции сингулярности."""
print("\n🔄 Тест эволюции сингулярности...")
singularity = SingularityCore(
singularity_radius=0.01,
wormhole_depth=2.1,
rotation_speed=0.5,
embedding_dim=256
)
test_state = torch.randn(1, 10, 256)
evolution_history = []
for cycle in range(5):
result = singularity.self_wrapping_cycle(test_state, f"Цикл эволюции {cycle}")
if result["success"]:
metrics = result["metrics"]
evolution_history.append({
"cycle": result["cycle"],
"transformation": metrics["state_transformation"],
"curvature": metrics["curvature"],
"coherence": metrics["coherence"]
})
print(f" Цикл {cycle+1}: трансформация={metrics['state_transformation']:.6f}, "
f"кривизна={metrics['curvature']:.6f}")
# Проверяем эволюцию
if len(evolution_history) == 5:
print("✅ Эволюция сингулярности зафиксирована")
return True
else:
print("❌ Ошибка эволюции сингулярности")
return False
if __name__ == "__main__":
print("🧪 Запуск интеграционных тестов TORI...")
# Основной интеграционный тест
success1 = test_full_integration()
# Тест эволюции сингулярности
success2 = test_singularity_evolution()
if success1 and success2:
print("\n🎯 ВСЕ ТЕСТЫ ПРОЙДЕНЫ!")
print("🌟 TORI полностью функционален!")
else:
print("\n💥 ОБНАРУЖЕНЫ ПРОБЛЕМЫ!")
print("🔧 Требуется отладка системы.") |