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
Update _utils.py
Daniel Hanc53b4394dcec
diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.pyindex a3263f85a9b..04ffd2062b7 100644--- a/unsloth/models/_utils.py+++ b/unsloth/models/_utils.py@@ -135,35 +135,36 @@ pass# =============================================# Get Flash Attention v2 if Ampere (RTX 30xx, A100)import bitsandbytes as bnb-from transformers.models.llama.modeling_llama import loggerfrom transformers import AutoTokenizer+from transformers.utils.import_utils import _is_package_availablemajor_version, minor_version = torch.cuda.get_device_capability()SUPPORTS_BFLOAT16 = Falseif major_version >= 8:SUPPORTS_BFLOAT16 = True- try:- from flash_attn import flash_attn_func+ if _is_package_available("flash_attn"):# Check for CUDA linking errors "undefined symbol: _ZNK3c106SymIntltEl"try:from flash_attn.flash_attn_interface import flash_attn_cudaHAS_FLASH_ATTENTION = Trueexcept:- logger.warning_once(+ 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 gets a 0.01% performance hit.\n"\+ "We shall now use Xformers instead, which does not have any performance hits!\n"\"We found this negligible impact by benchmarking on 1x A100.")HAS_FLASH_ATTENTION = False- except:+ else:HAS_FLASH_ATTENTION = Falseelse:# Tri Dao's benchmark shows xformers is faster for now.HAS_FLASH_ATTENTION = Falsepass++from transformers.models.llama.modeling_llama import loggerimport xformers.ops.fmha as xformersxformers_attention = xformers.memory_efficient_attentionfrom xformers import __version__ as xformers_version