ZOTHEOS commited on
Commit
65b4eba
Β·
verified Β·
1 Parent(s): 08ef0df

Update modules/config_settings_public.py

Browse files
Files changed (1) hide show
  1. modules/config_settings_public.py +12 -25
modules/config_settings_public.py CHANGED
@@ -1,4 +1,4 @@
1
- # FILE: modules/config_settings_public.py (Definitive Final Version)
2
 
3
  import os
4
  import sys
@@ -13,18 +13,17 @@ if not logger.handlers:
13
  logger.addHandler(handler)
14
  logger.setLevel(logging.INFO)
15
 
16
- # --- A more reliable way to detect if we are running in a Hugging Face Space ---
17
  IS_WEB_MODE = os.path.exists("/home/user/app")
18
 
19
- # --- Define Model Repositories and Filenames ONCE ---
20
  MODEL_DEFINITIONS = {
21
  "mistral": {
22
  "repo_id": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF",
23
  "filename": "mistral-7b-instruct-v0.2.Q4_K_M.gguf"
24
  },
25
  "gemma": {
26
- "repo_id": "google/gemma-2b-it-gguf", # βœ…βœ…βœ… THE ONLY CHANGE IS THIS LINE (GGUF -> gguf) βœ…βœ…βœ…
27
- "filename": "gemma-2b-it.Q4_K_M.gguf"
28
  },
29
  "qwen": {
30
  "repo_id": "Qwen/Qwen1.5-1.8B-Chat-GGUF",
@@ -32,14 +31,10 @@ 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} from repo: {model_info['repo_id']}")
45
  try:
@@ -48,20 +43,14 @@ if IS_WEB_MODE:
48
  except Exception as e:
49
  logger.error(f"❌ FAILED to download model {name}. Error: {e}")
50
  raise e
51
-
52
  N_GPU_LAYERS_FALLBACK = 0
53
- logger.info("N_GPU_LAYERS_FALLBACK forced to 0 for CPU-only web environment.")
54
-
55
  else: # LOCAL MODE
56
  logger.info("βœ…βœ…βœ… RUNNING IN LOCAL MODE (Desktop/PC) βœ…βœ…βœ…")
57
  APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
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
  for name, model_info in MODEL_DEFINITIONS.items():
61
  MODEL_PATHS[name] = os.path.join(BASE_MODELS_DIR, model_info["filename"])
62
  N_GPU_LAYERS_FALLBACK = -1
63
- logger.info("N_GPU_LAYERS_FALLBACK set to -1 for local GPU acceleration.")
64
-
65
 
66
  # --- Shared Configurations ---
67
  MAX_RAM_MODELS_GB = 23.8
@@ -76,25 +65,23 @@ MODEL_SPECIFIC_PARAMS = {
76
  "qwen": { "chat_format": "chatml" },
77
  "_default": {
78
  "f16_kv": True, "use_mmap": True, "use_mlock": False,
79
- "verbose": VERBOSE_LLAMA_CPP,
80
- "n_gpu_layers": N_GPU_LAYERS_FALLBACK,
81
- "n_threads": N_THREADS_FALLBACK,
82
- "n_ctx": N_CTX_FALLBACK
83
  }
84
  }
85
 
86
  INFERENCE_PRESETS = {
87
  "balanced": {"temperature": 0.7, "top_p": 0.9, "top_k": 40, "repeat_penalty": 1.1, "mirostat_mode": 0, "max_tokens": 1024},
88
  "precise": {"temperature": 0.2, "top_p": 0.7, "top_k": 20, "repeat_penalty": 1.05, "mirostat_mode": 0, "max_tokens": 1536},
89
- "creative": {"temperature": 0.9, "top_p": 0.95, "top_k": 60, "repeat_penalty": 1.15, "mirostat_mode": 2, "mirostat_tau": 4.0, "mirostat_eta": 0.1, "max_tokens": 1024},
90
- "passthrough": {}
91
  }
92
  DEFAULT_INFERENCE_PRESET = "balanced"
93
 
94
- 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."
95
  SYSTEM_PERSONAS = {
96
- "default": DEFAULT_SYSTEM_PROMPT, "helpful_assistant": "You are a helpful AI assistant.", "philosopher": "You are an AI philosopher.",
97
- "coder": "You are an expert AI programmer.", "concise_summarizer": "You are an AI tasked with providing very concise summaries."
 
98
  }
99
  MODEL_ROLES = {"mistral": "analyst", "gemma": "humanist", "qwen": "skeptic"}
100
  MODEL_ROLE_SYSTEM_PROMPTS = {
@@ -102,6 +89,6 @@ MODEL_ROLE_SYSTEM_PROMPTS = {
102
  "skeptic": "You are a critical evaluator and a respectful skeptic.", "general": DEFAULT_SYSTEM_PROMPT
103
  }
104
 
105
- ZOTHEOS_VERSION = "Public Beta 1.8 (Live)"
106
  logger.info(f"Config settings loaded. Version: {ZOTHEOS_VERSION}")
107
  logger.info(f"Web Mode: {IS_WEB_MODE}")
 
1
+ # FILE: modules/config_settings_public.py (Definitive Final Version 2 - Using TheBloke for Gemma)
2
 
3
  import os
4
  import sys
 
13
  logger.addHandler(handler)
14
  logger.setLevel(logging.INFO)
15
 
 
16
  IS_WEB_MODE = os.path.exists("/home/user/app")
17
 
18
+ # --- βœ…βœ…βœ… SWITCHED GEMMA TO A MORE RELIABLE PROVIDER: TheBloke βœ…βœ…βœ… ---
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", # Switched to TheBloke's repo
26
+ "filename": "gemma-2b-it.Q4_K_M.gguf" # Using the same quality file
27
  },
28
  "qwen": {
29
  "repo_id": "Qwen/Qwen1.5-1.8B-Chat-GGUF",
 
31
  }
32
  }
33
 
 
34
  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
  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__)))
50
  BASE_MODELS_DIR = os.path.join(APP_DIR, "models")
 
51
  for name, model_info in MODEL_DEFINITIONS.items():
52
  MODEL_PATHS[name] = os.path.join(BASE_MODELS_DIR, model_info["filename"])
53
  N_GPU_LAYERS_FALLBACK = -1
 
 
54
 
55
  # --- Shared Configurations ---
56
  MAX_RAM_MODELS_GB = 23.8
 
65
  "qwen": { "chat_format": "chatml" },
66
  "_default": {
67
  "f16_kv": True, "use_mmap": True, "use_mlock": False,
68
+ "verbose": VERBOSE_LLAMA_CPP, "n_gpu_layers": N_GPU_LAYERS_FALLBACK,
69
+ "n_threads": N_THREADS_FALLBACK, "n_ctx": N_CTX_FALLBACK
 
 
70
  }
71
  }
72
 
73
  INFERENCE_PRESETS = {
74
  "balanced": {"temperature": 0.7, "top_p": 0.9, "top_k": 40, "repeat_penalty": 1.1, "mirostat_mode": 0, "max_tokens": 1024},
75
  "precise": {"temperature": 0.2, "top_p": 0.7, "top_k": 20, "repeat_penalty": 1.05, "mirostat_mode": 0, "max_tokens": 1536},
76
+ "creative": {"temperature": 0.9, "top_p": 0.95, "top_k": 60, "repeat_penalty": 1.15, "mirostat_mode": 2, "mirostat_tau": 4.0, "mirostat_eta": 0.1, "max_tokens": 1024}
 
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 = {
 
89
  "skeptic": "You are a critical evaluator and a respectful skeptic.", "general": DEFAULT_SYSTEM_PROMPT
90
  }
91
 
92
+ ZOTHEOS_VERSION = "Public Beta 1.9 (TheBloke Gemma)"
93
  logger.info(f"Config settings loaded. Version: {ZOTHEOS_VERSION}")
94
  logger.info(f"Web Mode: {IS_WEB_MODE}")