wartung: Groesse je Quantisierung, GitHub-Antworten 15 min gemerkt, Hermes-Version auch bei haengendem Abruf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0e961f112b
commit
ee2bb9d03c
+13
-6
@@ -17,10 +17,12 @@ def normalize_repo(s: str) -> str:
|
||||
return s.strip("/")
|
||||
|
||||
|
||||
def list_quants(repo: str) -> list[str]:
|
||||
"""Verfügbare Quant-Stufen eines Repos (aus den GGUF-Dateinamen, ohne mmproj)."""
|
||||
def list_quants(repo: str) -> list[dict]:
|
||||
"""Verfügbare Quant-Stufen eines Repos mit Downloadgröße (alle Teile + mmproj), ohne mmproj
|
||||
als eigene Stufe. Ein Aufruf der Hugging-Face-API für alle Stufen."""
|
||||
baum = _tree(repo)
|
||||
quants: set[str] = set()
|
||||
for e in _tree(repo):
|
||||
for e in baum:
|
||||
p = str(e.get("path", ""))
|
||||
if p.lower().endswith(".gguf") and "mmproj" not in p.lower():
|
||||
m = re.search(r"(I?Q\d[\w]*|F16|BF16|FP16|F32)", p, re.IGNORECASE)
|
||||
@@ -28,7 +30,8 @@ def list_quants(repo: str) -> list[str]:
|
||||
quants.add(m.group(1).upper())
|
||||
# gängige Reihenfolge zuerst
|
||||
order = {"Q4_K_M": 0, "Q4_K_S": 1, "Q5_K_M": 2, "Q6_K": 3, "Q8_0": 4, "Q3_K_M": 5, "Q2_K": 6}
|
||||
return sorted(quants, key=lambda q: (order.get(q, 99), q))
|
||||
return [{"quant": q, "total_bytes": auswahl(baum, q)["total_bytes"]}
|
||||
for q in sorted(quants, key=lambda q: (order.get(q, 99), q))]
|
||||
|
||||
|
||||
def search(q: str = "", limit: int = 24) -> list[dict]:
|
||||
@@ -68,12 +71,16 @@ def _size(entry: dict) -> int:
|
||||
|
||||
|
||||
def resolve_gguf(repo: str, quant: str = "Q4_K_M") -> dict:
|
||||
"""Beste GGUF-Auswahl eines Repos für einen Quant. Behandelt Split-GGUFs
|
||||
"""Beste GGUF-Auswahl eines Repos für einen Quant (siehe auswahl)."""
|
||||
return auswahl(_tree(repo), quant)
|
||||
|
||||
|
||||
def auswahl(tree: list[dict], quant: str = "Q4_K_M") -> dict:
|
||||
"""GGUF-Auswahl aus dem Dateibaum eines Repos für einen Quant. Behandelt Split-GGUFs
|
||||
(-00001-of-000NN) als Gruppe. Liefert die Datei-/Pattern-Infos für den Download.
|
||||
|
||||
Rückgabe: {files:[paths], first:path, total_bytes:int, mmproj:path|None, split:bool}
|
||||
"""
|
||||
tree = _tree(repo)
|
||||
ggufs = [e for e in tree if str(e.get("path", "")).lower().endswith(".gguf")]
|
||||
q = quant.lower()
|
||||
# mmproj separat (Vision-Projektor)
|
||||
|
||||
Reference in New Issue
Block a user