Spaces:
Sleeping
Sleeping
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 (
|
2 |
|
3 |
import os
|
4 |
import sys
|
@@ -15,15 +15,15 @@ if not logger.handlers:
|
|
15 |
|
16 |
IS_WEB_MODE = os.path.exists("/home/user/app")
|
17 |
|
18 |
-
# ---
|
19 |
MODEL_DEFINITIONS = {
|
20 |
"mistral": {
|
21 |
"repo_id": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF",
|
22 |
"filename": "mistral-7b-instruct-v0.2.Q4_K_M.gguf"
|
23 |
},
|
24 |
"gemma": {
|
25 |
-
"repo_id": "TheBloke/gemma-2B-it-GGUF",
|
26 |
-
"filename": "gemma-2b-it.Q4_K_M.gguf"
|
27 |
},
|
28 |
"qwen": {
|
29 |
"repo_id": "Qwen/Qwen1.5-1.8B-Chat-GGUF",
|
@@ -35,6 +35,7 @@ MODEL_PATHS = {}
|
|
35 |
|
36 |
if IS_WEB_MODE:
|
37 |
logger.info("β
β
β
RUNNING IN WEB MODE (Hugging Face Space) β
β
β
")
|
|
|
38 |
for name, model_info in MODEL_DEFINITIONS.items():
|
39 |
logger.info(f"Downloading model: {name} from repo: {model_info['repo_id']}")
|
40 |
try:
|
@@ -43,7 +44,6 @@ if IS_WEB_MODE:
|
|
43 |
except Exception as e:
|
44 |
logger.error(f"β FAILED to download model {name}. Error: {e}")
|
45 |
raise e
|
46 |
-
N_GPU_LAYERS_FALLBACK = 0
|
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__)))
|
@@ -53,42 +53,28 @@ else: # LOCAL MODE
|
|
53 |
N_GPU_LAYERS_FALLBACK = -1
|
54 |
|
55 |
# --- Shared Configurations ---
|
56 |
-
MAX_RAM_MODELS_GB = 23.8
|
57 |
MAX_CONCURRENT_MODELS = 3
|
58 |
N_CTX_FALLBACK = 2048
|
59 |
-
N_THREADS_FALLBACK = 8
|
60 |
VERBOSE_LLAMA_CPP = True
|
61 |
-
|
62 |
MODEL_SPECIFIC_PARAMS = {
|
63 |
-
"mistral": { "chat_format": "mistral-instruct" },
|
64 |
-
"gemma": { "chat_format": "gemma" },
|
65 |
-
"qwen": { "chat_format": "chatml" },
|
66 |
"_default": {
|
67 |
-
"
|
68 |
-
"
|
69 |
-
|
70 |
-
}
|
|
|
71 |
}
|
72 |
-
|
73 |
INFERENCE_PRESETS = {
|
74 |
-
"balanced": {"temperature": 0.7, "top_p": 0.9, "top_k": 40, "repeat_penalty": 1.1, "
|
75 |
-
"precise": {"temperature": 0.2, "top_p": 0.7, "top_k": 20, "repeat_penalty": 1.05, "
|
76 |
-
"creative": {"temperature": 0.9, "top_p": 0.95, "top_k": 60, "repeat_penalty": 1.15, "
|
77 |
}
|
78 |
DEFAULT_INFERENCE_PRESET = "balanced"
|
79 |
-
|
80 |
-
DEFAULT_SYSTEM_PROMPT = "You are ZOTHEOS, an ethical AI developed to help humanity. Provide clear, concise, and helpful responses."
|
81 |
-
SYSTEM_PERSONAS = {
|
82 |
-
"default": DEFAULT_SYSTEM_PROMPT, "helpful_assistant": "You are a helpful AI assistant.",
|
83 |
-
"philosopher": "You are an AI philosopher.", "coder": "You are an expert AI programmer.",
|
84 |
-
"concise_summarizer": "You are an AI tasked with providing very concise summaries."
|
85 |
-
}
|
86 |
MODEL_ROLES = {"mistral": "analyst", "gemma": "humanist", "qwen": "skeptic"}
|
87 |
MODEL_ROLE_SYSTEM_PROMPTS = {
|
88 |
"analyst": "You are an impartial analyst.", "humanist": "You are a human-centered assistant.",
|
89 |
"skeptic": "You are a critical evaluator and a respectful skeptic.", "general": DEFAULT_SYSTEM_PROMPT
|
90 |
}
|
91 |
-
|
92 |
-
|
93 |
-
logger.info(f"Config settings loaded. Version: {ZOTHEOS_VERSION}")
|
94 |
-
logger.info(f"Web Mode: {IS_WEB_MODE}")
|
|
|
1 |
+
# FILE: modules/config_settings_public.py (Gold Master Version)
|
2 |
|
3 |
import os
|
4 |
import sys
|
|
|
15 |
|
16 |
IS_WEB_MODE = os.path.exists("/home/user/app")
|
17 |
|
18 |
+
# --- Verified Model Definitions ---
|
19 |
MODEL_DEFINITIONS = {
|
20 |
"mistral": {
|
21 |
"repo_id": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF",
|
22 |
"filename": "mistral-7b-instruct-v0.2.Q4_K_M.gguf"
|
23 |
},
|
24 |
"gemma": {
|
25 |
+
"repo_id": "TheBloke/gemma-2B-it-GGUF",
|
26 |
+
"filename": "gemma-2b-it.Q4_K_M.gguf"
|
27 |
},
|
28 |
"qwen": {
|
29 |
"repo_id": "Qwen/Qwen1.5-1.8B-Chat-GGUF",
|
|
|
35 |
|
36 |
if IS_WEB_MODE:
|
37 |
logger.info("β
β
β
RUNNING IN WEB MODE (Hugging Face Space) β
β
β
")
|
38 |
+
N_GPU_LAYERS_FALLBACK = 0
|
39 |
for name, model_info in MODEL_DEFINITIONS.items():
|
40 |
logger.info(f"Downloading model: {name} from repo: {model_info['repo_id']}")
|
41 |
try:
|
|
|
44 |
except Exception as e:
|
45 |
logger.error(f"β FAILED to download model {name}. Error: {e}")
|
46 |
raise e
|
|
|
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__)))
|
|
|
53 |
N_GPU_LAYERS_FALLBACK = -1
|
54 |
|
55 |
# --- Shared Configurations ---
|
|
|
56 |
MAX_CONCURRENT_MODELS = 3
|
57 |
N_CTX_FALLBACK = 2048
|
|
|
58 |
VERBOSE_LLAMA_CPP = True
|
|
|
59 |
MODEL_SPECIFIC_PARAMS = {
|
|
|
|
|
|
|
60 |
"_default": {
|
61 |
+
"n_gpu_layers": N_GPU_LAYERS_FALLBACK, "n_ctx": N_CTX_FALLBACK, "f16_kv": True,
|
62 |
+
"use_mmap": True, "verbose": VERBOSE_LLAMA_CPP
|
63 |
+
},
|
64 |
+
"mistral": {"chat_format": "mistral-instruct"}, "gemma": {"chat_format": "gemma"},
|
65 |
+
"qwen": {"chat_format": "chatml"}
|
66 |
}
|
|
|
67 |
INFERENCE_PRESETS = {
|
68 |
+
"balanced": {"temperature": 0.7, "top_p": 0.9, "top_k": 40, "repeat_penalty": 1.1, "max_tokens": 1024},
|
69 |
+
"precise": {"temperature": 0.2, "top_p": 0.7, "top_k": 20, "repeat_penalty": 1.05, "max_tokens": 1536},
|
70 |
+
"creative": {"temperature": 0.9, "top_p": 0.95, "top_k": 60, "repeat_penalty": 1.15, "max_tokens": 1024}
|
71 |
}
|
72 |
DEFAULT_INFERENCE_PRESET = "balanced"
|
73 |
+
DEFAULT_SYSTEM_PROMPT = "You are ZOTHEOS, an ethical AI developed to help humanity."
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
MODEL_ROLES = {"mistral": "analyst", "gemma": "humanist", "qwen": "skeptic"}
|
75 |
MODEL_ROLE_SYSTEM_PROMPTS = {
|
76 |
"analyst": "You are an impartial analyst.", "humanist": "You are a human-centered assistant.",
|
77 |
"skeptic": "You are a critical evaluator and a respectful skeptic.", "general": DEFAULT_SYSTEM_PROMPT
|
78 |
}
|
79 |
+
ZOTHEOS_VERSION = "2.0 (Live)"
|
80 |
+
logger.info(f"Config loaded. Version: {ZOTHEOS_VERSION}, Web Mode: {IS_WEB_MODE}")
|
|
|
|