Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Make replacement logic conscise

datta0e8d6ede1fdd9
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index f41f95a85f8..0230f84565e 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -217,12 +217,11 @@ def extract_approx_params_from_config(config):
billions = float(match_B.group(1))
return int(1_000_000_000 * billions)
else:
- for fam in lowercase_b_families:
- if fam in cleaned.lower():
- match_b = re.search(r"([0-9]+(?:\.[0-9]+)?)\s*b", cleaned)
- if match_b:
- billions = float(match_b.group(1))
- return int(1_000_000_000 * billions)
+ if any(fam in cleaned.lower() for fam in lowercase_b_families):
+ match_b = re.search(r"([0-9]+(?:\.[0-9]+)?)\s*b", cleaned)
+ if match_b:
+ billions = float(match_b.group(1))
+ return int(1_000_000_000 * billions)
else:
match_any = re.search(r"([0-9]+(?:\.[0-9]+)?)\s*[bB]", cleaned)
if match_any: