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 Han61a3daa66723
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex c7e630d4230..475f82a5b1a 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -759,14 +759,9 @@ def LlamaModel_fast_forward(# Check checkpointing methodgradient_checkpointing = False- offloaded_gradient_checkpointing = Falseif (self.gradient_checkpointing and self.training and not use_cache):-gradient_checkpointing = True-- if output_attentions is False and hasattr(self, "_offloaded_gradient_checkpointing"):- offloaded_gradient_checkpointing = Truepass# Gemma2 has alternating SWA and global attn@@ -1975,9 +1970,14 @@ class FastLlamaModel:internal_model = modelwhile hasattr(internal_model, "model"):internal_model._saved_temp_tokenizer = tokenizer+ # Also set is_loaded_in_8bit to disable incorrect DDP+ internal_model.is_loaded_in_8bit = True+internal_model = internal_model.modelpassinternal_model._saved_temp_tokenizer = tokenizer+ # Also set is_loaded_in_8bit to disable incorrect DDP+ internal_model.is_loaded_in_8bit = True# For transformers > 4.47.1, we need to add rotary_emb to all attention layersif IS_ATTENTION_REFACTOR or hasattr(model.model, "rotary_emb"):@@ -2387,11 +2387,15 @@ class FastLlamaModel:if hasattr(internal_model, "_saved_temp_tokenizer"):internal_model._saved_temp_tokenizer.padding_side = "right"pass+ # Also set is_loaded_in_8bit to disable incorrect DDP+ internal_model.is_loaded_in_8bit = Trueinternal_model = internal_model.modelpassif hasattr(internal_model, "_saved_temp_tokenizer"):internal_model._saved_temp_tokenizer.padding_side = "right"pass+ # Also set is_loaded_in_8bit to disable incorrect DDP+ internal_model.is_loaded_in_8bit = True# Clear deleted GPU itemsfor _ in range(3):