From 4cebfabaa686be2fa46212a5680a6562e56ce77f Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Thu, 11 Jun 2026 22:21:46 -0700 Subject: [PATCH] fix(spark): whole-token device-name match so GB10 != GB100/GB10X A loose substring match ("GB10" in name) misdetected a discrete Grace+Blackwell datacenter GPU (e.g. nvidia-smi name containing "GB100") as a unified-memory DGX Spark, applying the UMA tuning (pin_memory off, vLLM disabled, allocator capped to 0.80) and regressing that hardware. Match each device-name token with non-alphanumeric boundaries instead. Found by a platform x device-name gating simulation; the real N1X (JMJWOA-Generic-GPU) still detects, GB100/B100/GB200/GH200/B200 now correctly reject. Co-Authored-By: Claude Opus 4.8 --- studio/backend/core/training/worker.py | 8 ++++++-- unsloth/kernels/flex_attention.py | 7 ++++++- unsloth/models/_utils.py | 14 ++++++++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/studio/backend/core/training/worker.py b/studio/backend/core/training/worker.py index 0d1e51343d..f52dfc48f1 100644 --- a/studio/backend/core/training/worker.py +++ b/studio/backend/core/training/worker.py @@ -749,8 +749,10 @@ def _nvidia_classify_spark_unified_memory(props: Any) -> tuple[str, bool]: if getattr(props, "is_integrated", 0): return "is_integrated", True name_upper = (getattr(props, "name", "") or "").upper() + import re for token in ("GB10", "GB110", "JMJWOA", "N1X", "DGX SPARK"): - if token in name_upper: + # Whole-token match so "GB10" does not match a discrete "GB100"/"GB10X". + if re.search(r"(? timeout = 5, ) _names_u = (_smi.stdout or "").upper() + import re as _re _spark_smi = any( - t in _names_u for t in ("GB10", "GB110", "JMJWOA", "N1X", "DGX SPARK") + _re.search(r"(?