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 flex_attention.py
Daniel Han297e25007cfb
diff --git a/unsloth/kernels/flex_attention.py b/unsloth/kernels/flex_attention.pyindex dfd48504d50..678574928c5 100644--- a/unsloth/kernels/flex_attention.py+++ b/unsloth/kernels/flex_attention.py@@ -42,14 +42,15 @@ if not HAS_FLEX_ATTENTION:# Below fails on compiled_autograd, so disable ittry:- old_compiled_autograd = torch._dynamo.config.compiled_autograd- torch._dynamo.config.compiled_autograd = False+ disable_compiled_autograd = torch._dynamo.compiled_autograd.disableexcept:- old_compiled_autograd = False+ disable_compiled_autograd = lambda *args, **kwargs: *args, **kwargspass# Logit softcapping- @torch.compile(fullgraph = True, dynamic = True, options = torch_compile_options)+ @disable_compiled_autograd(+ torch.compile(fullgraph = True, dynamic = True, options = torch_compile_options)+ )def slow_attention_softcapping(Q, K, V, causal_mask, self, bsz, q_len):n_heads = self.num_headshead_dim = self.head_dim@@ -82,13 +83,6 @@ if not HAS_FLEX_ATTENTION:return Apass- # Return compiled_autograd back- try:- torch._dynamo.config.compiled_autograd = old_compiled_autograd- except:- pass- pass-create_flex_attention_causal_mask = Nonecreate_flex_attention_sliding_window_mask = Noneelse: