ZOTHEOS commited on
Commit
40b3752
Β·
verified Β·
1 Parent(s): 0fe887d

Update modules/config_settings_public.py

Browse files
Files changed (1) hide show
  1. modules/config_settings_public.py +20 -28
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(sys.stdout)
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 and faster, perfect for a CPU-based web demo.
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" # Using a smaller Q2_K quantization for speed
22
  },
23
  "gemma": {
24
- "repo_id": "TheBloke/gemma-2b-it-GGUF",
25
- "filename": "gemma-2b-it.Q4_K_M.gguf" # Using the 2B parameter version
26
  },
27
  "qwen": {
28
- "repo_id": "TheBloke/Qwen1.5-1.8B-Chat-GGUF",
29
- "filename": "qwen1.5-1.8b-chat.Q4_K_M.gguf" # Using the 1.8B parameter version
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 for Hugging Face free tier
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
- # --- βœ… WEB-OPTIMIZED MODEL PARAMETERS ---
49
  MODEL_SPECIFIC_PARAMS = {
50
  "_default": {
51
- "n_gpu_layers": N_GPU_LAYERS_FALLBACK, # Ensures CPU usage
52
- "n_ctx": 4096, # Smaller context window for lower RAM usage
53
- "n_batch": 512, # Standard batch size for CPU
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
- # --- βœ… TIER INFERENCE PRESETS ---
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. Break down complex topics into clear, understandable points. Respond only in English.",
74
- "humanist": "You are an empathetic and values-driven AI. Focus on the emotional, ethical, and societal impact. Consider the human element above all. Respond only in English.",
75
- "skeptic": "You are a respectful but rigorous skeptic. Challenge the user's premise, identify potential risks, question assumptions, and explore alternative interpretations. Respond only in English.",
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.")