From 98e7207953c64d7df3db0c1b70dbd921d911e17f Mon Sep 17 00:00:00 2001 From: Sleeps Date: Tue, 6 Oct 2026 15:02:10 +0100 Subject: [PATCH] Configure dual caption models and routing policy --- scene_search/config.py | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/scene_search/config.py b/scene_search/config.py index 3c75cd4..ee742e0 100644 --- a/scene_search/config.py +++ b/scene_search/config.py @@ -21,15 +21,47 @@ class Settings: batch_size: int = int(os.getenv("BATCH_SIZE", "8")) ollama_url: str = os.getenv("OLLAMA_URL", "http://127.0.0.1:11434").rstrip("/") - caption_model: str = os.getenv( - "CAPTION_MODEL", - "huihui_ai/qwen3-vl-abliterated:4b-instruct-q4_K_M", + caption_general_model: str = os.getenv( + "CAPTION_GENERAL_MODEL", + os.getenv( + "CAPTION_MODEL", + "huihui_ai/qwen3-vl-abliterated:4b-instruct-q4_K_M", + ), + ) + caption_specialist_model: str = os.getenv( + "CAPTION_SPECIALIST_MODEL", + "aha2025/llama-joycaption-beta-one-hf-llava:Q4_K_M", ) caption_timeout_seconds: int = int(os.getenv("CAPTION_TIMEOUT_SECONDS", "180")) caption_max_tokens: int = int(os.getenv("CAPTION_MAX_TOKENS", "120")) caption_prompt_file: Path = Path( os.getenv("CAPTION_PROMPT_FILE", "./data/caption_prompt.txt") ).expanduser().resolve() + caption_specialist_prompt_file: Path = Path( + os.getenv( + "CAPTION_SPECIALIST_PROMPT_FILE", + "./data/caption_prompt_specialist.txt", + ) + ).expanduser().resolve() + + caption_router_enabled: bool = os.getenv( + "CAPTION_ROUTER_ENABLED", "true" + ).strip().lower() not in {"0", "false", "no", "off"} + caption_router_model: str = os.getenv( + "CAPTION_ROUTER_MODEL", "Falconsai/nsfw_image_detection" + ) + caption_router_device: str = os.getenv( + "CAPTION_ROUTER_DEVICE", os.getenv("DEVICE", "cuda") + ) + caption_router_batch_size: int = int( + os.getenv("CAPTION_ROUTER_BATCH_SIZE", "32") + ) + caption_router_threshold: float = float( + os.getenv("CAPTION_ROUTER_THRESHOLD", "0.50") + ) + caption_router_context_seconds: float = float( + os.getenv("CAPTION_ROUTER_CONTEXT_SECONDS", "6") + ) data_dir: Path = Path(os.getenv("DATA_DIR", "./data")).resolve()