From fc0153d0de52f6c7bcce9e7122a9966843157d3e Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Thu, 25 Jun 2026 12:40:44 +0200 Subject: [PATCH] fix(2.0): model_id bei Split-GGUFs im Quant-Unterordner (nicht Q4_K_M) model_id_from_path steigt bei Quant-Ordner (Q4_K_M/, UD-Q4_K_M/) eine Ebene hoch zum Repo-Ordner. Sonst hiess das Heavy-Modell Q4_K_M. Co-Authored-By: Claude Opus 4.8 --- backend/services/llamaswap.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/services/llamaswap.py b/backend/services/llamaswap.py index 3888aec..bed1759 100644 --- a/backend/services/llamaswap.py +++ b/backend/services/llamaswap.py @@ -91,8 +91,12 @@ def engine_reachable() -> bool: # --- Schreiben --------------------------------------------------------------- def model_id_from_path(model_path: str) -> str: """Sprechende Modell-ID (= API-Name) aus dem GGUF-Pfad: Repo-Ordnername ohne - '-GGUF'. Fallback: Dateiname ohne Quant-Suffix.""" + '-GGUF'. Fallback: Dateiname ohne Quant-Suffix. + Split-GGUFs liegen oft in einem Quant-Unterordner (…/Q4_K_M/file-00001-of-…) → + dann eine Ebene höher (Repo-Ordner) nehmen, sonst hieße das Modell 'Q4_K_M'.""" d = os.path.basename(os.path.dirname(model_path)) + if re.fullmatch(r"(I?Q\d[\w]*|UD-Q\d[\w]*|F16|BF16|FP16|F32)", d, flags=re.I): + d = os.path.basename(os.path.dirname(os.path.dirname(model_path))) name = re.sub(r"[-_]?GGUF$", "", d, flags=re.I).strip("-_") if not name: fn = re.sub(r"\.gguf$", "", os.path.basename(model_path), flags=re.I)