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
lm_head issue (#266)
Daniel Hanb9d5ca53dce9
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex b7aae06ee55..6b258dbb6b0 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -599,7 +599,7 @@ def LlamaModel_fast_forward(else:boundaries = Nonepass-+for idx, decoder_layer in enumerate(self.layers):if output_hidden_states:all_hidden_states += (hidden_states,)@@ -1601,7 +1601,11 @@ class FastLlamaModel:pass# Also check if lm_head / embeddings are trained- lm_head = getattr(model, "model", model).lm_head.weight+ internal_model = model+ while not hasattr(internal_model, "lm_head"):+ internal_model = internal_model.model+ pass+ lm_head = internal_model.lm_head.weightdevice_type = lm_head.device.typedtype = model.config.torch_dtype