Fix: GGUF-Gesamtgroesse inkl. Split-Teile (heavy zeigte nur 10MB Header-Teil)
_gguf_total_size summiert alle ...-NNNNN-of-NNNNN.gguf-Teile. size_bytes des ersten Teils war bei Split-Modellen wie Qwen3.5-122B (11M Header + 47G + 25G) irrefuehrend. Fix wirkt in UI-Anzeige UND Budget-Footprint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,24 @@ ROLE_IDS = {"fast", "heavy", "coder", "vision", "scout"}
|
||||
_CTX_RE = re.compile(r"-(?:c|-ctx-size)\s+(\d+)")
|
||||
_PATH_RE = re.compile(r"-(?:m|-model)\s+([^\s]+)")
|
||||
_QUANT_RE = re.compile(r"(Q\d_[A-Z0-9_]+|IQ\d_[A-Z0-9_]+|fp16|bf16)\.gguf", re.IGNORECASE)
|
||||
_SPLIT_RE = re.compile(r"-(\d+)-of-(\d+)\.gguf$", re.IGNORECASE)
|
||||
|
||||
|
||||
def _gguf_total_size(path: str) -> int | None:
|
||||
"""Gesamtgröße eines GGUF inkl. ALLER Split-Teile (…-00001-of-00003.gguf).
|
||||
Die Größe nur des ersten Teils ist bei Splits irreführend (oft nur ein Header)."""
|
||||
try:
|
||||
base = os.path.basename(path)
|
||||
m = _SPLIT_RE.search(base)
|
||||
if not m:
|
||||
return os.path.getsize(path)
|
||||
prefix, dirn = base[:m.start()], os.path.dirname(path)
|
||||
total = sum(os.path.getsize(os.path.join(dirn, f))
|
||||
for f in os.listdir(dirn)
|
||||
if f.startswith(prefix) and _SPLIT_RE.search(f))
|
||||
return total or os.path.getsize(path)
|
||||
except OSError:
|
||||
return None
|
||||
|
||||
|
||||
# --- Lesen -------------------------------------------------------------------
|
||||
@@ -54,7 +72,7 @@ def _parse_model(name: str, spec: dict) -> dict:
|
||||
path = m.group(1).replace("'", "").replace('"', "")
|
||||
filename = os.path.basename(path)
|
||||
if os.path.exists(path):
|
||||
size_bytes = os.path.getsize(path)
|
||||
size_bytes = _gguf_total_size(path)
|
||||
if (q := _QUANT_RE.search(path)):
|
||||
quant = q.group(1).upper()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user