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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
fix(ROCm): Comprehensive RDNA GPU support - fix Gemma3 NaN & add is_rdna() (#4109)
金黄色葡萄球君君8a8dcd48ddcf
diff --git a/unsloth/kernels/utils.py b/unsloth/kernels/utils.pyindex 0b13c045320..b1211ae3450 100644--- a/unsloth/kernels/utils.py+++ b/unsloth/kernels/utils.py@@ -86,6 +86,15 @@ def is_cdna():)[email protected]_cache(1)+def is_rdna():+ """Detect RDNA consumer/workstation GPUs (RDNA3, RDNA3.5, RDNA4)."""+ if not is_hip():+ return False+ arch = triton.runtime.driver.active.get_current_target().arch+ return arch.startswith("gfx1") and not is_cdna()++def calculate_settings(n: int,) -> (diff --git a/unsloth/models/loader.py b/unsloth/models/loader.pyindex 711476b7596..7bb2a24e004 100644--- a/unsloth/models/loader.py+++ b/unsloth/models/loader.py@@ -1131,6 +1131,14 @@ class FastModel(FastBaseModel):# Set norms to float32 since anyways they get upcasted to float32# common in both gemma-3 and gemma-3nos.environ["UNSLOTH_HIGH_PRECISION_LAYERNORM"] = "1"+ # ROCm/HIP: Gemma3 compiled forward produces NaN on RDNA GPUs+ # (gfx1100, gfx1101, gfx1102, gfx1150, gfx1151, etc.).+ # Disable torch.compile for model forward; loss compilation is fine.+ # See https://github.com/unslothai/unsloth/issues/3385+ from unsloth.kernels.utils import is_rdna++ if is_rdna():+ os.environ["UNSLOTH_COMPILE_DISABLE"] = "partial"# Cohereelif "cohere2" in model_types_all and transformers_version < Version("4.50.0.dev0"