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
Fix: prevent rope_embedding AssertionError by checking kv_seq_len before reuse (#3578)
Yuxiao Chenged829b672a6e
diff --git a/unsloth/models/falcon_h1.py b/unsloth/models/falcon_h1.pyindex 70223a3c20d..3010d371635 100644--- a/unsloth/models/falcon_h1.py+++ b/unsloth/models/falcon_h1.py@@ -116,7 +116,7 @@ def FalconH1Attention_fast_forward(if past_key_value is not None:kv_seq_len += past_key_value[0].shape[-2]- if position_embeddings:+ if position_embeddings and kv_seq_len <= position_embeddings[0].shape[0]:cos, sin = position_embeddingselse:# Extend RoPE dynamically to fit in VRAdiff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex caf259c0bd0..502cbec8bd9 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -566,7 +566,7 @@ def LlamaAttention_fast_forward(if past_key_value is not None:kv_seq_len += past_key_value[0].shape[-2]- if position_embeddings:+ if position_embeddings and kv_seq_len <= position_embeddings[0].shape[0]:cos, sin = position_embeddingselse:# Extend RoPE dynamically to fit in VRAdiff --git a/unsloth/models/qwen3.py b/unsloth/models/qwen3.pyindex 3d905fe06ac..1a0d6415527 100644--- a/unsloth/models/qwen3.py+++ b/unsloth/models/qwen3.py@@ -110,7 +110,7 @@ def Qwen3Attention_fast_forward(if past_key_value is not None:kv_seq_len += past_key_value[0].shape[-2]- if position_embeddings:+ if position_embeddings and kv_seq_len <= position_embeddings[0].shape[0]:cos, sin = position_embeddingselse:# Extend RoPE dynamically to fit in VRA