Team Ai
Apppublic

Awashes/coherence

sourceHugging Faceopenrailupdated 8mo agoView on Hugging Face
0likes
debug.py68 linesDownload Raw Back to root
1import os
2import sys
3
4print("๐Ÿ” STARTING GHOST DIAGNOSTIC TOOL...")
5print("-" * 40)
6
7# 1. CHECK LIBRARIES
8print("[1/4] Checking Libraries...")
9try:
10    import numpy
11    print("   โœ… numpy found.")
12except ImportError:
13    print("   โŒ CRITICAL: 'numpy' is missing. Run: pip install numpy")
14
15try:
16    import sentence_transformers
17    print("   โœ… sentence_transformers found.")
18except ImportError:
19    print("   โŒ CRITICAL: 'sentence-transformers' is missing. Run: pip install sentence-transformers")
20
21try:
22    import llama_cpp
23    print("   โœ… llama_cpp found.")
24except ImportError:
25    print("   โŒ CRITICAL: 'llama-cpp-python' is missing.")
26
27# 2. CHECK MODEL FILE
28print("\n[2/4] Checking AI Brain...")
29# Configured name in your code
30EXPECTED_NAME = "Llama-3.2-3B-Instruct-Q4_K_M.gguf"
31model_path = os.path.join("models", EXPECTED_NAME)
32
33if os.path.exists(model_path):
34    print(f"   โœ… Model found at: {model_path}")
35else:
36    print(f"   โŒ CRITICAL: Model missing or named wrong!")
37    print(f"      Expected: {EXPECTED_NAME}")
38    print(f"      Found in 'models' folder:")
39    if os.path.exists("models"):
40        for f in os.listdir("models"):
41            print(f"       - {f}")
42    else:
43        print("       (Models folder does not exist)")
44
45# 3. CHECK DATABASE STRUCTURE
46print("\n[3/4] Checking Database Schema...")
47import sqlite3
48DB_NAME = "ghost_users.db"
49
50if not os.path.exists(DB_NAME):
51    print("   โš ๏ธ Database not found (Will be created on server start).")
52else:
53    try:
54        conn = sqlite3.connect(DB_NAME)
55        cursor = conn.execute("PRAGMA table_info(users)")
56        columns = [row[1] for row in cursor.fetchall()]
57        conn.close()
58        
59        if "current_vector" in columns:
60            print("   โœ… Database is UP TO DATE (Vector column exists).")
61        else:
62            print("   โŒ CRITICAL: Database is OUTDATED.")
63            print("      Action: Delete 'ghost_users.db' immediately.")
64    except Exception as e:
65        print(f"   โŒ Database Error: {e}")
66
67print("-" * 40)
68print("DIAGNOSTIC COMPLETE.")