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.

Improve HIP GPU name detection in startup banner (#4048)

Daniel Hand3fcba134bce
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index 9c4e8742d22..e5b73db0796 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -28,6 +28,7 @@ __all__ = [
"HAS_FLASH_ATTENTION_SOFTCAPPING",
"USE_MODELSCOPE",
"platform_system",
+ "resolve_hip_gpu_stats_name",
"patch_tokenizer",
"get_statistics",
"Unsloth_Offloaded_Gradient_Checkpointer",
@@ -149,6 +150,37 @@ from unsloth_zoo.compiler import (
from unsloth_zoo.training_utils import (
prepare_model_for_training,
)
+
+
+def resolve_hip_gpu_stats_name(gpu_stats):
+ name = str(getattr(gpu_stats, "name", "") or "").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()
+ except Exception:
+ torch_name = ""
+ normalized_torch_name = torch_name.lower().strip(". ")
+ if normalized_torch_name and normalized_torch_name not in ("amd radeon graphics",):
+ return torch_name + ". "
+
+ arch_name = ""
+ for key in ("gcnArchName", "gcn_arch_name", "arch_name", "gfx_arch_name"):
+ value = getattr(gpu_stats, key, None)
+ if value is not None and str(value).strip():
+ arch_name = str(value).strip()
+ 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. "
+
+
from unsloth_zoo.temporary_patches import (
TEMPORARY_PATCHES,
)
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py
index 043d2363c13..dcaa770baab 100644
--- a/unsloth/models/llama.py
+++ b/unsloth/models/llama.py
@@ -2245,9 +2245,7 @@ class FastLlamaModel:
vllm_version = ""
elif DEVICE_TYPE == "hip":
gpu_stats = torch.cuda.get_device_properties(0)
- gpu_stats_name = (
- gpu_stats.name + ". " if gpu_stats.name != "" else "AMD GPU Device. "
- )
+ gpu_stats_name = resolve_hip_gpu_stats_name(gpu_stats)
gpu_version = torch.version.hip
gpu_stats_snippet = f"ROCm Toolkit: {gpu_version}."
try:
diff --git a/unsloth/models/vision.py b/unsloth/models/vision.py
index c294dbdb0bf..9e292a28490 100644
--- a/unsloth/models/vision.py
+++ b/unsloth/models/vision.py
@@ -497,9 +497,7 @@ class FastBaseModel:
vllm_version = ""
elif DEVICE_TYPE == "hip":
gpu_stats = torch.cuda.get_device_properties(0)
- gpu_stats_name = (
- gpu_stats.name + ". " if gpu_stats.name != "" else "AMD GPU Device. "
- )
+ gpu_stats_name = resolve_hip_gpu_stats_name(gpu_stats)
gpu_version = torch.version.hip
gpu_stats_snippet = f"ROCm Toolkit: {gpu_version}."
try: