FredinVázquez commited on
Commit ·
6f82324
1
Parent(s): 6d25a57
add config routes
Browse files- src/config.py +61 -0
src/config.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Paths, model IDs, and runtime constants."""
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
ROOT = Path(__file__).resolve().parent.parent
|
| 8 |
+
DATA_DIR = ROOT / "data"
|
| 9 |
+
ASSETS_DIR = ROOT / "assets"
|
| 10 |
+
PROMPTS_DIR = ROOT / "src" / "prompts"
|
| 11 |
+
CACHE_DIR = Path(os.environ.get("COOK_WITH_ME_CACHE", Path.home() / ".cache" / "cook-with-me"))
|
| 12 |
+
FLUX_CACHE = CACHE_DIR / "flux"
|
| 13 |
+
AUDIO_CACHE = CACHE_DIR / "audio"
|
| 14 |
+
|
| 15 |
+
for _d in (DATA_DIR, ASSETS_DIR, CACHE_DIR, FLUX_CACHE, AUDIO_CACHE):
|
| 16 |
+
_d.mkdir(parents=True, exist_ok=True)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# --- Model identifiers ------------------------------------------------------
|
| 20 |
+
VISION_REPO = "openbmb/MiniCPM-V-4_6-gguf"
|
| 21 |
+
VISION_MODEL_FILE = "Model-Q4_K_M.gguf"
|
| 22 |
+
VISION_MMPROJ_FILE = "mmproj-model-f16.gguf"
|
| 23 |
+
|
| 24 |
+
PLANNER_REPO = "openbmb/MiniCPM-V-4-gguf"
|
| 25 |
+
PLANNER_MODEL_FILE = "Model-Q4_K_M.gguf"
|
| 26 |
+
|
| 27 |
+
FLUX_REPO = "black-forest-labs/FLUX.2-klein-9B"
|
| 28 |
+
NARRATOR_REPO = "openbmb/VoxCPM2"
|
| 29 |
+
EMBED_MODEL = "sentence-transformers/all-MiniLM-L6-v2"
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
# --- Recipe dataset ---------------------------------------------------------
|
| 33 |
+
KAGGLE_DATASET = "thedevastator/better-recipes-for-a-better-life"
|
| 34 |
+
RECIPES_PARQUET = DATA_DIR / "recipes.parquet"
|
| 35 |
+
RECIPES_EMB_NPY = DATA_DIR / "recipes_emb.npy"
|
| 36 |
+
NUTRITION_CSV = DATA_DIR / "nutrition_table.csv"
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
# --- Generation knobs -------------------------------------------------------
|
| 40 |
+
N_THREADS = int(os.environ.get("COOK_WITH_ME_THREADS", os.cpu_count() or 4))
|
| 41 |
+
N_CTX = 4096
|
| 42 |
+
PLANNER_TEMPERATURE_PROPOSE = 0.7
|
| 43 |
+
PLANNER_TEMPERATURE_STRUCTURED = 0.4
|
| 44 |
+
|
| 45 |
+
FLUX_STEPS = 4
|
| 46 |
+
FLUX_GUIDANCE = 1.0
|
| 47 |
+
FLUX_RESOLUTION = 1024
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
# --- Runtime flags ----------------------------------------------------------
|
| 51 |
+
def is_mock() -> bool:
|
| 52 |
+
"""When True, agents return canned outputs instead of loading models."""
|
| 53 |
+
return os.environ.get("COOK_WITH_ME_MOCK", "0") not in ("0", "", "false", "False")
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def is_gpu_enabled() -> bool:
|
| 57 |
+
try:
|
| 58 |
+
import torch
|
| 59 |
+
return torch.cuda.is_available()
|
| 60 |
+
except Exception:
|
| 61 |
+
return False
|