From cc32777f30df414d0457aaf7e321e92a2a5a6908 Mon Sep 17 00:00:00 2001 From: sqersters <109853788+bouclem@users.noreply.github.com> Date: Fri, 12 Jun 2026 16:57:25 +0200 Subject: [PATCH] Studio: keep distinct bpw flavors of the same GGUF quant (#5729) list_gguf_variants() keys files by _extract_quant_label(), which only captured the base quant token. Repos that ship the same base quant at multiple bits-per-weight (e.g. byteshape/Qwen3.6-35B-A3B-MTP-GGUF with three IQ4_XS files at 3.53/3.97/4.19 bpw) collapsed into a single row and Studio summed their sizes (~48 GB). Extend the regex to capture an optional trailing -(.)?bpw modifier so each flavor produces a unique label. Round-trips through _find_local_gguf_by_variant and _download_gguf since both sides use the same extractor. Fixes #5728. Co-authored-by: Etherll <61019402+Etherll@users.noreply.github.com> --- studio/backend/utils/models/model_config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/studio/backend/utils/models/model_config.py b/studio/backend/utils/models/model_config.py index 3381ae0391..f91b8fb8c9 100644 --- a/studio/backend/utils/models/model_config.py +++ b/studio/backend/utils/models/model_config.py @@ -1343,6 +1343,7 @@ def _extract_quant_label(filename: str) -> str: "model-UD-IQ1_S.gguf" → "UD-IQ1_S" "model-UD-TQ1_0.gguf" → "UD-TQ1_0" "MXFP4_MOE/model-MXFP4_MOE-0001.gguf"→ "MXFP4_MOE" + "Qwen3.6-IQ4_XS-3.53bpw.gguf" → "IQ4_XS-3.53bpw" """ import re @@ -1358,6 +1359,10 @@ def _extract_quant_label(filename: str) -> str: r"|Q[0-9]+_[0-9]+" # Standard: Q8_0, Q5_1 r"|Q[0-9]+_K" # Short K-quant: Q6_K r"|BF16|F16|F32)" # Full precision + # Optional bits-per-weight modifier so repos that ship multiple + # files at the same base quant (e.g. byteshape's IQ4_XS at 3.53, + # 3.97, 4.19 bpw) don't collapse into a single merged variant. + r"(-[0-9]+(?:\.[0-9]+)?bpw)?" ) match = re.search(quant_re, stem, re.IGNORECASE) # Subdir layouts like ``BF16/foo.gguf`` keep the quant in the directory, @@ -1372,7 +1377,8 @@ def _extract_quant_label(filename: str) -> str: break if match: prefix = match.group(1) or "" - return f"{prefix}{match.group(2)}" + bpw = match.group(3) or "" + return f"{prefix}{match.group(2)}{bpw}" # Fallback: last hyphen-separated segment return stem.split("-")[-1]