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 llama.py

Daniel Han35dada2a99a7
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py
index de53704e661..9b920fdac9f 100644
--- a/unsloth/models/llama.py
+++ b/unsloth/models/llama.py
@@ -86,16 +86,13 @@ from triton import __version__ as triton_version
HAS_XFORMERS = xformers is not None
BlockDiagonalCausalMask = 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_cache
get_current_device = torch.xpu.current_device
else:
+ clean_gpu_cache = torch.cuda.empty_cache
get_current_device = torch.cuda.current_device
+pass
def original_apply_qkv(self, X):
Q = self.q_proj(X)