Spaces:
Running
Running
# FILE: modules/config_settings_public.py (HF Demo - v9.0) | |
import os | |
import logging | |
from huggingface_hub import hf_hub_download | |
logger = logging.getLogger("ZOTHEOS_Config_HF") | |
# --- β DEFINITIVE & VERIFIED WEB-OPTIMIZED MODEL SOURCES --- | |
MODEL_DEFINITIONS = { | |
"mistral": { | |
"repo_id": "TheBloke/Mistral-7B-Instruct-v0.2-GGUF", | |
"filename": "mistral-7b-instruct-v0.2.Q2_K.gguf" | |
}, | |
"gemma": { | |
"repo_id": "google/gemma-2b-it-gguf", | |
"filename": "gemma-2b-it.gguf" | |
}, | |
"qwen": { | |
"repo_id": "Qwen/Qwen1.5-1.8B-Chat-GGUF", # This is the correct, official GGUF repository | |
"filename": "qwen1_5-1_8b-chat-q2_k.gguf" # β This is a verified, existing file in that repo | |
} | |
} | |
MODEL_PATHS = {} | |
logger.info("β β β RUNNING IN WEB DEMO MODE (True Fusion - CPU Survival) β β β ") | |
N_GPU_LAYERS_FALLBACK = 0 # Force CPU-only mode | |
for name, model_info in MODEL_DEFINITIONS.items(): | |
logger.info(f"Downloading demo model: {name} from {model_info['repo_id']}...") | |
try: | |
MODEL_PATHS[name] = hf_hub_download(repo_id=model_info["repo_id"], filename=model_info["filename"]) | |
logger.info(f"β Successfully downloaded {name}") | |
except Exception as e: | |
logger.error(f"β FAILED to download {name}: {e}") | |
raise e | |
# --- β CPU-OPTIMIZED MODEL PARAMETERS --- | |
MODEL_SPECIFIC_PARAMS = { | |
"_default": { | |
"n_gpu_layers": N_GPU_LAYERS_FALLBACK, | |
"n_ctx": 1024, | |
"n_batch": 256, | |
"n_threads": 4, | |
"verbose": True | |
}, | |
"mistral": { "chat_format": "mistral-instruct" }, | |
"gemma": { "chat_format": "gemma" }, | |
"qwen": { "chat_format": "chatml" } | |
} | |
# --- TIER INFERENCE & PROMPTS --- | |
INFERENCE_PRESETS = {"balanced": {"temperature": 0.7, "max_tokens": 256}} | |
DEFAULT_INFERENCE_PRESET = "balanced" | |
DEFAULT_SYSTEM_PROMPT = "You are ZOTHEOS, an ethical AI. Respond concisely and only in English." | |
MODEL_ROLES = {"mistral": "analyst", "gemma": "humanist", "qwen": "skeptic"} | |
MODEL_ROLE_SYSTEM_PROMPTS = { | |
"analyst": "You are an analyst. Be logical. Respond only in English.", | |
"humanist": "You are a humanist. Focus on values. Respond only in English.", | |
"skeptic": "You are a skeptic. Challenge the premise. Respond only in English.", | |
} | |
logger.info("β Hugging Face Demo (CPU Survival Mode) Configuration Loaded.") |