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 llama.py
Daniel Han35dada2a99a7
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex de53704e661..9b920fdac9f 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -86,16 +86,13 @@ from triton import __version__ as triton_versionHAS_XFORMERS = xformers is not NoneBlockDiagonalCausalMask = xformers.attn_bias.BlockDiagonalCausalMask if HAS_XFORMERS else None-def clean_gpu_cache():- if DEVICE_TYPE == "xpu":- torch.xpu.empty_cache()- else:- torch.cuda.empty_cache()-if DEVICE_TYPE == "xpu":+ clean_gpu_cache = torch.xpu.empty_cacheget_current_device = torch.xpu.current_deviceelse:+ clean_gpu_cache = torch.cuda.empty_cacheget_current_device = torch.cuda.current_device+passdef original_apply_qkv(self, X):Q = self.q_proj(X)