From 596683e7ca43a300b447a2ba575de8ea4ff7e227 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sat, 14 Feb 2026 02:24:03 -0800 Subject: [PATCH] Simplify MI300X startup banner name (#4049) * Improve HIP GPU name reporting in startup banner * Drop MI300X arch suffix in banner name * Normalize _utils.py file mode * Simplify FA2 fallback text and filter AMD ids noise * Strip trailing GPU arch suffix via regex * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use gfx lookup default and normalize Ryzen AI naming * Remove name-path Ryzen AI normalization * Expand ROCm gfx map to full documented GPU name aliases * Simplify HIP fallback naming to AMD gfx token * Remove Ryzen Al torch_name normalization --------- Co-authored-by: Daniel Hanchen Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- unsloth/import_fixes.py | 2 ++ unsloth/models/_utils.py | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py index 8d00b793c9..d037903bec 100644 --- a/unsloth/import_fixes.py +++ b/unsloth/import_fixes.py @@ -199,6 +199,8 @@ if os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") != "1": # Triton "df: No such file or directory" stderr noise sys.stderr.add_filter("df: No such file") + # ROCm/libdrm missing ids table stderr noise on some AMD setups + sys.stderr.add_filter("amdgpu.ids: No such file or directory") # Fix up AttributeError: 'MessageFactory' object has no attribute 'GetPrototype' diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index e5b73db079..451f60091f 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -154,12 +154,14 @@ from unsloth_zoo.training_utils import ( def resolve_hip_gpu_stats_name(gpu_stats): name = str(getattr(gpu_stats, "name", "") or "").strip() + name = re.sub(r"\s*\([^)]*\)\s*$", "", name).strip() normalized_name = name.lower().strip(". ") if normalized_name and normalized_name not in ("amd radeon graphics",): return name + ". " try: torch_name = str(torch.cuda.get_device_name(0) or "").strip() + torch_name = re.sub(r"\s*\([^)]*\)\s*$", "", torch_name).strip() except Exception: torch_name = "" normalized_torch_name = torch_name.lower().strip(". ") @@ -174,11 +176,11 @@ def resolve_hip_gpu_stats_name(gpu_stats): break if arch_name: - # gfx942 maps to MI300X on current ROCm naming. - if arch_name.lower().startswith("gfx942"): - return f"AMD Instinct MI300X ({arch_name}). " - return f"AMD GPU ({arch_name}). " - return "AMD GPU Device. " + arch_name = arch_name.strip() + match = re.search(r"(gfx[0-9a-z]+)", arch_name, flags = re.I) + if match: + return f"AMD {match.group(1).lower()} GPU. " + return "AMD GPU. " from unsloth_zoo.temporary_patches import ( @@ -874,10 +876,8 @@ if DEVICE_TYPE == "cuda": ) except: print( - "Unsloth: Your Flash Attention 2 installation seems to be broken?\n" - "A possible explanation is you have a new CUDA version which isn't\n" - "yet compatible with FA2? Please file a ticket to Unsloth or FA2.\n" - "We shall now use Xformers instead, which does not have any performance hits!" + "Unsloth: Your Flash Attention 2 installation seems to be broken. " + "Using Xformers instead. No performance changes will be seen." ) # Stop Flash Attention from importing! @@ -925,10 +925,8 @@ elif DEVICE_TYPE == "hip": ) except: print( - "Unsloth: Your Flash Attention 2 installation seems to be broken?\n" - "A possible explanation is you have a new CUDA version which isn't\n" - "yet compatible with FA2? Please file a ticket to Unsloth or FA2.\n" - "We shall now use Xformers instead, which does not have any performance hits!" + "Unsloth: Your Flash Attention 2 installation seems to be broken. " + "Using Xformers instead. No performance changes will be seen." ) # Stop Flash Attention from importing!