SHOREKEEPER / scripts /09_run_tests.py
geoore's picture
Restructure to src/ layout with attention, per-layer MoE, and working chat
73400c8
#!/usr/bin/env python3
"""Simple test script to verify SHOREKEEPER is working."""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
print("=" * 50)
print("Testing SHOREKEEPER-4B Installation")
print("=" * 50)
# Test 1: Import modules
print("\n1. Testing imports...")
try:
from src.shorekeeper import SHOREKEEPER
print(" βœ“ SHOREKEEPER imported successfully")
except Exception as e:
print(f" βœ— Failed to import SHOREKEEPER: {e}")
sys.exit(1)
try:
from src.council import Sentinel, BaseExpert, EXPERT_REGISTRY
print(" βœ“ Council modules imported successfully")
except Exception as e:
print(f" βœ— Failed to import council: {e}")
try:
from src.memory import JSONLibrary
print(" βœ“ Memory module imported successfully")
except Exception as e:
print(f" βœ— Failed to import memory: {e}")
# Test 2: Create model instance
print("\n2. Creating SHOREKEEPER instance...")
try:
model = SHOREKEEPER()
print(" βœ“ Model created successfully")
print(f" βœ“ Number of experts: {len(model.experts)}")
print(f" βœ“ Expert names: {list(model.experts.keys())}")
except Exception as e:
print(f" βœ— Failed to create model: {e}")
# Test 3: Test memory
print("\n3. Testing memory system...")
try:
mem_id = model.remember("Test fact: SHOREKEEPER is working")
print(f" βœ“ Memory stored with ID: {mem_id}")
memories = model.recall("test")
print(f" βœ“ Memory recall found {len(memories)} items")
except Exception as e:
print(f" βœ— Memory test failed: {e}")
# Test 4: Test forward pass
print("\n4. Testing forward pass...")
try:
import torch
dummy_input = torch.randint(0, 1000, (1, 128))
with torch.no_grad():
output = model(dummy_input)
print(f" βœ“ Forward pass successful. Output shape: {output.shape}")
except Exception as e:
print(f" βœ— Forward pass failed: {e}")
print("\n" + "=" * 50)
print("βœ… All tests passed! SHOREKEEPER is ready.")
print("=" * 50)
print("\nTo run SHOREKEEPER:")
print(" python scripts/07_run_shorekeeper.py")