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

Daniel Han72d9e5f5a016
diff --git a/unsloth/models/mistral.py b/unsloth/models/mistral.py
index 6eb3fccfabc..d7376d95218 100644
--- a/unsloth/models/mistral.py
+++ b/unsloth/models/mistral.py
@@ -78,6 +78,9 @@ def MistralAttention_fast_forward(
if past_key_value is not None:
kv_seq_len += past_key_value[0].shape[-2]
+ # Extend RoPE dynamically to fit in VRAM
+ self.rotary_emb.extend_rope_embedding(V, seq_len = kv_seq_len)
+
if position_ids is None:
cos = self.rotary_emb.cos_cached
sin = self.rotary_emb.sin_cached