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
only warn about prepare causal attention mask when transformers<=4.52.4 (#2867)
DoubleMathewe858f08047bd
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex d0ff413925f..7d56dac2ecd 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -152,12 +152,13 @@ def _fast_prepare_inputs_for_generation(self, input_ids, attention_mask=None, **)else:attention_mask = attention_mask[:,[-1]]- logger.warning_once(- f"{self.__class__.__name__} has no `_prepare_4d_causal_attention_mask_with_cache_position` method "- "defined in its base modeling class. Compiled forward passes will be sub-optimal. If you're "- "writing code, see Llama for an example implementation. If you're a user, please report this "- "issue on GitHub."- )+ if transformers_version <= Version("4.52.4"):+ logger.warning_once(+ f"{self.__class__.__name__} has no `_prepare_4d_causal_attention_mask_with_cache_position` method "+ "defined in its base modeling class. Compiled forward passes will be sub-optimal. If you're "+ "writing code, see Llama for an example implementation. If you're a user, please report this "+ "issue on GitHub."+ )if "cache_position" in kwargs:kwargs["position_ids"] = kwargs["cache_position"]