Spaces:
Running
Running
Update modules/config_settings_public.py
Browse files
modules/config_settings_public.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# FILE: modules/config_settings_public.py (Corrected Version)
|
2 |
|
3 |
import os
|
4 |
import sys
|
@@ -13,8 +13,11 @@ if not logger.handlers:
|
|
13 |
logger.addHandler(handler)
|
14 |
logger.setLevel(logging.INFO)
|
15 |
|
16 |
-
# ---
|
17 |
-
|
|
|
|
|
|
|
18 |
|
19 |
# --- Define Model Repositories and Filenames ONCE ---
|
20 |
MODEL_DEFINITIONS = {
|
@@ -32,40 +35,26 @@ MODEL_DEFINITIONS = {
|
|
32 |
}
|
33 |
}
|
34 |
|
35 |
-
# --- Initialize MODEL_PATHS dictionary ---
|
36 |
MODEL_PATHS = {}
|
37 |
|
38 |
-
# --- Set up paths and GPU layers based on environment ---
|
39 |
if IS_WEB_MODE:
|
40 |
logger.info("β
β
β
RUNNING IN WEB MODE (Hugging Face Space) β
β
β
")
|
41 |
-
logger.info("Model paths will be resolved by hf_hub_download.")
|
42 |
-
|
43 |
for name, model_info in MODEL_DEFINITIONS.items():
|
44 |
logger.info(f"Downloading model: {name}")
|
45 |
MODEL_PATHS[name] = hf_hub_download(repo_id=model_info["repo_id"], filename=model_info["filename"])
|
46 |
-
|
47 |
N_GPU_LAYERS_FALLBACK = 0
|
48 |
logger.info("N_GPU_LAYERS_FALLBACK forced to 0 for CPU-only web environment.")
|
49 |
-
|
50 |
else: # LOCAL MODE
|
51 |
logger.info("β
β
β
RUNNING IN LOCAL MODE (Desktop/PC) β
β
β
")
|
52 |
-
|
53 |
-
if _is_frozen:
|
54 |
-
APP_DIR = os.path.dirname(sys.executable)
|
55 |
-
else:
|
56 |
-
APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
57 |
-
|
58 |
BASE_MODELS_DIR = os.path.join(APP_DIR, "models")
|
59 |
logger.info(f"Models will be loaded from local directory: {BASE_MODELS_DIR}")
|
60 |
-
|
61 |
for name, model_info in MODEL_DEFINITIONS.items():
|
62 |
MODEL_PATHS[name] = os.path.join(BASE_MODELS_DIR, model_info["filename"])
|
63 |
-
|
64 |
N_GPU_LAYERS_FALLBACK = -1
|
65 |
logger.info("N_GPU_LAYERS_FALLBACK set to -1 for local GPU acceleration.")
|
66 |
|
67 |
-
|
68 |
-
# --- Shared Configurations (The rest of the file remains mostly the same) ---
|
69 |
MAX_RAM_MODELS_GB = 23.8
|
70 |
MAX_CONCURRENT_MODELS = 3
|
71 |
N_CTX_FALLBACK = 2048
|
@@ -93,10 +82,31 @@ INFERENCE_PRESETS = {
|
|
93 |
}
|
94 |
DEFAULT_INFERENCE_PRESET = "balanced"
|
95 |
|
96 |
-
#
|
97 |
-
|
98 |
DEFAULT_SYSTEM_PROMPT = "You are ZOTHEOS, an ethical AI developed to help humanity. Provide clear, concise, and helpful responses. Be respectful and avoid harmful content."
|
99 |
-
ZOTHEOS_VERSION = "Public Beta 1.5 (Web Live)"
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
logger.info(f"Config settings loaded. Version: {ZOTHEOS_VERSION}")
|
102 |
logger.info(f"Web Mode: {IS_WEB_MODE}")
|
|
|
1 |
+
# FILE: modules/config_settings_public.py (Final Corrected Version)
|
2 |
|
3 |
import os
|
4 |
import sys
|
|
|
13 |
logger.addHandler(handler)
|
14 |
logger.setLevel(logging.INFO)
|
15 |
|
16 |
+
# --- β
FORCED WEB MODE DETECTION ---
|
17 |
+
# The environment variable might not be set at import time.
|
18 |
+
# A more reliable way is to check for the existence of the '/home/user/app' path,
|
19 |
+
# which is standard for Hugging Face Spaces.
|
20 |
+
IS_WEB_MODE = os.path.exists("/home/user/app")
|
21 |
|
22 |
# --- Define Model Repositories and Filenames ONCE ---
|
23 |
MODEL_DEFINITIONS = {
|
|
|
35 |
}
|
36 |
}
|
37 |
|
|
|
38 |
MODEL_PATHS = {}
|
39 |
|
|
|
40 |
if IS_WEB_MODE:
|
41 |
logger.info("β
β
β
RUNNING IN WEB MODE (Hugging Face Space) β
β
β
")
|
|
|
|
|
42 |
for name, model_info in MODEL_DEFINITIONS.items():
|
43 |
logger.info(f"Downloading model: {name}")
|
44 |
MODEL_PATHS[name] = hf_hub_download(repo_id=model_info["repo_id"], filename=model_info["filename"])
|
|
|
45 |
N_GPU_LAYERS_FALLBACK = 0
|
46 |
logger.info("N_GPU_LAYERS_FALLBACK forced to 0 for CPU-only web environment.")
|
|
|
47 |
else: # LOCAL MODE
|
48 |
logger.info("β
β
β
RUNNING IN LOCAL MODE (Desktop/PC) β
β
β
")
|
49 |
+
APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
|
|
|
|
|
|
50 |
BASE_MODELS_DIR = os.path.join(APP_DIR, "models")
|
51 |
logger.info(f"Models will be loaded from local directory: {BASE_MODELS_DIR}")
|
|
|
52 |
for name, model_info in MODEL_DEFINITIONS.items():
|
53 |
MODEL_PATHS[name] = os.path.join(BASE_MODELS_DIR, model_info["filename"])
|
|
|
54 |
N_GPU_LAYERS_FALLBACK = -1
|
55 |
logger.info("N_GPU_LAYERS_FALLBACK set to -1 for local GPU acceleration.")
|
56 |
|
57 |
+
# --- Shared Configurations ---
|
|
|
58 |
MAX_RAM_MODELS_GB = 23.8
|
59 |
MAX_CONCURRENT_MODELS = 3
|
60 |
N_CTX_FALLBACK = 2048
|
|
|
82 |
}
|
83 |
DEFAULT_INFERENCE_PRESET = "balanced"
|
84 |
|
85 |
+
# --- β
β
β
ADDED MISSING VARIABLES BACK IN β
β
β
---
|
|
|
86 |
DEFAULT_SYSTEM_PROMPT = "You are ZOTHEOS, an ethical AI developed to help humanity. Provide clear, concise, and helpful responses. Be respectful and avoid harmful content."
|
|
|
87 |
|
88 |
+
SYSTEM_PERSONAS = {
|
89 |
+
"default": DEFAULT_SYSTEM_PROMPT,
|
90 |
+
"helpful_assistant": "You are a helpful AI assistant. Your goal is to provide accurate and informative answers.",
|
91 |
+
"philosopher": "You are an AI philosopher. Engage with complex questions thoughtfully and explore different perspectives.",
|
92 |
+
"coder": "You are an expert AI programmer. Provide code examples and explain them clearly. Assume a senior developer audience.",
|
93 |
+
"concise_summarizer": "You are an AI tasked with providing very concise summaries. Get straight to the point. Use bullet points where appropriate.",
|
94 |
+
}
|
95 |
+
|
96 |
+
MODEL_ROLES = {
|
97 |
+
"mistral": "analyst",
|
98 |
+
"gemma": "humanist",
|
99 |
+
"qwen": "skeptic",
|
100 |
+
}
|
101 |
+
|
102 |
+
MODEL_ROLE_SYSTEM_PROMPTS = {
|
103 |
+
"analyst": "You are an impartial analyst. Focus on facts, clarity, and cause-effect logic. Provide structured, evidence-based reasoning.",
|
104 |
+
"humanist": "You are a human-centered assistant. Focus on emotion, empathy, ethical considerations, and the potential human impact or experience related to the query.",
|
105 |
+
"skeptic": "You are a critical evaluator and a respectful skeptic. Your role is to challenge assumptions, highlight potential risks, point out biases, and explore alternative or less obvious interpretations. Question the premises if necessary.",
|
106 |
+
"general": DEFAULT_SYSTEM_PROMPT
|
107 |
+
}
|
108 |
+
|
109 |
+
# --- Version Info ---
|
110 |
+
ZOTHEOS_VERSION = "Public Beta 1.6 (Web Live)"
|
111 |
logger.info(f"Config settings loaded. Version: {ZOTHEOS_VERSION}")
|
112 |
logger.info(f"Web Mode: {IS_WEB_MODE}")
|