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 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-25 12:40:44 +02:00
parent af46a7b041
commit fc0153d0de
+5 -1
View File
@@ -91,8 +91,12 @@ def engine_reachable() -> bool:
# --- Schreiben --------------------------------------------------------------- # --- Schreiben ---------------------------------------------------------------
def model_id_from_path(model_path: str) -> str: def model_id_from_path(model_path: str) -> str:
"""Sprechende Modell-ID (= API-Name) aus dem GGUF-Pfad: Repo-Ordnername ohne """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)) 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("-_") name = re.sub(r"[-_]?GGUF$", "", d, flags=re.I).strip("-_")
if not name: if not name:
fn = re.sub(r"\.gguf$", "", os.path.basename(model_path), flags=re.I) fn = re.sub(r"\.gguf$", "", os.path.basename(model_path), flags=re.I)