Spaces:
Sleeping
Sleeping
Update modules/config_settings_public.py
Browse files
modules/config_settings_public.py
CHANGED
@@ -1,40 +1,38 @@
|
|
1 |
-
# FILE: modules/config_settings_public.py (Hugging Face Demo)
|
2 |
|
3 |
import os
|
4 |
-
import sys
|
5 |
import logging
|
6 |
from huggingface_hub import hf_hub_download
|
7 |
|
8 |
logger = logging.getLogger("ZOTHEOS_Config")
|
9 |
if not logger.handlers:
|
10 |
-
handler = logging.StreamHandler(
|
11 |
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - [%(funcName)s] - %(message)s')
|
12 |
handler.setFormatter(formatter)
|
13 |
logger.addHandler(handler)
|
14 |
logger.setLevel(logging.INFO)
|
15 |
|
16 |
-
# --- β
WEB-OPTIMIZED MODEL SOURCES ---
|
17 |
-
# These models are smaller
|
18 |
MODEL_DEFINITIONS = {
|
19 |
"mistral": {
|
20 |
"repo_id": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF",
|
21 |
-
"filename": "mistral-7b-instruct-v0.2.Q2_K.gguf" #
|
22 |
},
|
23 |
"gemma": {
|
24 |
-
"repo_id": "
|
25 |
-
"filename": "gemma-2b-it.
|
26 |
},
|
27 |
"qwen": {
|
28 |
-
"repo_id": "
|
29 |
-
"filename": "
|
30 |
}
|
31 |
}
|
32 |
|
33 |
MODEL_PATHS = {}
|
34 |
|
35 |
-
# This logic will only run when the code is on Hugging Face Spaces.
|
36 |
logger.info("β
β
β
RUNNING IN WEB DEMO MODE (Hugging Face Space) β
β
β
")
|
37 |
-
N_GPU_LAYERS_FALLBACK = 0 # Force CPU-only mode
|
38 |
|
39 |
for name, model_info in MODEL_DEFINITIONS.items():
|
40 |
logger.info(f"Downloading model for demo: {name} from {model_info['repo_id']}")
|
@@ -45,12 +43,12 @@ for name, model_info in MODEL_DEFINITIONS.items():
|
|
45 |
logger.error(f"β FAILED to download {name}: {e}")
|
46 |
raise e
|
47 |
|
48 |
-
# ---
|
49 |
MODEL_SPECIFIC_PARAMS = {
|
50 |
"_default": {
|
51 |
-
"n_gpu_layers": N_GPU_LAYERS_FALLBACK,
|
52 |
-
"n_ctx":
|
53 |
-
"n_batch": 512,
|
54 |
"verbose": True
|
55 |
},
|
56 |
"mistral": { "chat_format": "mistral-instruct" },
|
@@ -58,21 +56,15 @@ MODEL_SPECIFIC_PARAMS = {
|
|
58 |
"qwen": { "chat_format": "chatml" }
|
59 |
}
|
60 |
|
61 |
-
# ---
|
62 |
-
INFERENCE_PRESETS = {
|
63 |
-
"balanced": {"temperature": 0.7, "top_p": 0.9, "max_tokens": 1024, "repeat_penalty": 1.1 },
|
64 |
-
"precise": {"temperature": 0.2, "top_p": 0.7, "top_k": 20, "max_tokens": 1536, "repeat_penalty": 1.05 },
|
65 |
-
"creative": {"temperature": 0.9, "top_p": 0.95, "top_k": 60, "max_tokens": 1024, "repeat_penalty": 1.15 }
|
66 |
-
}
|
67 |
DEFAULT_INFERENCE_PRESET = "balanced"
|
68 |
-
|
69 |
-
# --- β
TIER MODEL ROLES AND PROMPTS ---
|
70 |
-
DEFAULT_SYSTEM_PROMPT = "You are ZOTHEOS, an ethical AI developed to help humanity. Be clear, respectful, and helpful. Respond only in English."
|
71 |
MODEL_ROLES = {"mistral": "analyst", "gemma": "humanist", "qwen": "skeptic"}
|
72 |
MODEL_ROLE_SYSTEM_PROMPTS = {
|
73 |
-
"analyst": "You are an impartial analyst. Provide structured, logical insights.
|
74 |
-
"humanist": "You are an empathetic
|
75 |
-
"skeptic": "You are a respectful
|
76 |
}
|
77 |
|
78 |
logger.info("β
Hugging Face Demo Configuration Loaded Successfully.")
|
|
|
1 |
+
# FILE: modules/config_settings_public.py (Hugging Face Demo - v2.0 - Verified Models)
|
2 |
|
3 |
import os
|
|
|
4 |
import logging
|
5 |
from huggingface_hub import hf_hub_download
|
6 |
|
7 |
logger = logging.getLogger("ZOTHEOS_Config")
|
8 |
if not logger.handlers:
|
9 |
+
handler = logging.StreamHandler()
|
10 |
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - [%(funcName)s] - %(message)s')
|
11 |
handler.setFormatter(formatter)
|
12 |
logger.addHandler(handler)
|
13 |
logger.setLevel(logging.INFO)
|
14 |
|
15 |
+
# --- β
VERIFIED WEB-OPTIMIZED MODEL SOURCES ---
|
16 |
+
# These models are smaller, faster.
|
17 |
MODEL_DEFINITIONS = {
|
18 |
"mistral": {
|
19 |
"repo_id": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF",
|
20 |
+
"filename": "mistral-7b-instruct-v0.2.Q2_K.gguf" # Smallest quantization for speed
|
21 |
},
|
22 |
"gemma": {
|
23 |
+
"repo_id": "google/gemma-2b-it-gguf", # Using the official Google repository
|
24 |
+
"filename": "gemma-2b-it.gguf"
|
25 |
},
|
26 |
"qwen": {
|
27 |
+
"repo_id": "Qwen/Qwen1.5-1.8B-Chat-GGUF", # Using the official Qwen repository
|
28 |
+
"filename": "qwen1_5-1.8b-chat-q4_k_m.gguf"
|
29 |
}
|
30 |
}
|
31 |
|
32 |
MODEL_PATHS = {}
|
33 |
|
|
|
34 |
logger.info("β
β
β
RUNNING IN WEB DEMO MODE (Hugging Face Space) β
β
β
")
|
35 |
+
N_GPU_LAYERS_FALLBACK = 0 # Force CPU-only mode
|
36 |
|
37 |
for name, model_info in MODEL_DEFINITIONS.items():
|
38 |
logger.info(f"Downloading model for demo: {name} from {model_info['repo_id']}")
|
|
|
43 |
logger.error(f"β FAILED to download {name}: {e}")
|
44 |
raise e
|
45 |
|
46 |
+
# --- WEB-OPTIMIZED MODEL PARAMETERS ---
|
47 |
MODEL_SPECIFIC_PARAMS = {
|
48 |
"_default": {
|
49 |
+
"n_gpu_layers": N_GPU_LAYERS_FALLBACK,
|
50 |
+
"n_ctx": 2048, # Smaller context for lower RAM
|
51 |
+
"n_batch": 512,
|
52 |
"verbose": True
|
53 |
},
|
54 |
"mistral": { "chat_format": "mistral-instruct" },
|
|
|
56 |
"qwen": { "chat_format": "chatml" }
|
57 |
}
|
58 |
|
59 |
+
# --- AGI-TIER INFERENCE & PROMPTS ---
|
60 |
+
INFERENCE_PRESETS = {"balanced": {"temperature": 0.7, "max_tokens": 512}}
|
|
|
|
|
|
|
|
|
61 |
DEFAULT_INFERENCE_PRESET = "balanced"
|
62 |
+
DEFAULT_SYSTEM_PROMPT = "You are ZOTHEOS, an ethical AI. Respond only in English."
|
|
|
|
|
63 |
MODEL_ROLES = {"mistral": "analyst", "gemma": "humanist", "qwen": "skeptic"}
|
64 |
MODEL_ROLE_SYSTEM_PROMPTS = {
|
65 |
+
"analyst": "You are an impartial analyst. Provide structured, logical insights. Respond only in English.",
|
66 |
+
"humanist": "You are an empathetic AI. Focus on the emotional and ethical impact. Respond only in English.",
|
67 |
+
"skeptic": "You are a respectful skeptic. Question assumptions and highlight risks. Respond only in English.",
|
68 |
}
|
69 |
|
70 |
logger.info("β
Hugging Face Demo Configuration Loaded Successfully.")
|