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

Daniel Han6b735edbcb97
diff --git a/unsloth/models/granite.py b/unsloth/models/granite.py
index bfaea9a5553..b268d744aa5 100644
--- a/unsloth/models/granite.py
+++ b/unsloth/models/granite.py
@@ -279,12 +279,12 @@ def GraniteAttention_fast_forward_inference(
# Prefill phase
# if not hasattr(self, "paged_attention"):
if do_prefill:
- self.paged_attention = torch.empty((KV_CACHE_INCREMENT+seq_len+1, 2, bsz, n_kv_heads, head_dim), dtype = dtype, device = device)
+ self.paged_attention = torch.empty((KV_CACHE_INCREMENT+seq_len+1, 2, bsz, n_kv_heads, head_dim), dtype = dtype, device = device))
self.paged_attention_K = self.paged_attention[:,0]
self.paged_attention_V = self.paged_attention[:,1]
self.paged_attention_K[:seq_len] = K1.permute(2, 0, 1, 3)
self.paged_attention_V[:seq_len] = V1.permute(2, 0, 1, 3)
- self.temp_QA = torch.empty((2, bsz, 1, attention_size), dtype = dtype, device = device
+ self.temp_QA = torch.empty((2, bsz, 1, attention_size), dtype = dtype, device = device)
self.temp_KV = torch.empty((2, bsz, 1, n_kv_heads*head_dim), dtype = dtype, device = device)
self.RH_Q = torch.empty((bsz, n_heads, 1, head_dim), dtype = dtype, device = device)
# Only for Gemma2