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.

Update _utils.py

Daniel Hana6fcbbe8146c
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py
index bd3985e68d3..82bd81e3c31 100644
--- a/unsloth/models/_utils.py
+++ b/unsloth/models/_utils.py
@@ -683,8 +683,12 @@ try:
pass
import xformers.ops.fmha as xformers
xformers_attention = xformers.memory_efficient_attention
+except ModuleNotFoundError:
+ xformers = None
+ xformers_attention = None
+ xformers_version = None
except Exception as e:
- print("========\nSwitching to SDPA PyTorch native attention which is slightly slower.\n========\n")
+ print("========\nSwitching to PyTorch attention since your Xformers is broken.\n========\n")
print(str(e))
xformers = None
xformers_attention = None