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 Han65f754e0f46b
diff --git a/unsloth/models/llama.py b/unsloth/models/llama.pyindex 044ea6e244a..a53f52fe271 100644--- a/unsloth/models/llama.py+++ b/unsloth/models/llama.py@@ -1869,14 +1869,19 @@ class FastLlamaModel:# We also do this for the lm_headif old_output_embedding.numel() != 0:+requires_grad = old_output_embedding.requires_gradlm_head = torch.nn.Linear(1, 1, bias = None)del lm_head.weight+lm_head.weight = old_output_embedding if not is_tied else old_input_embeddinglm_head.in_features = lm_head.weight.shape[1]lm_head.out_features = lm_head.weight.shape[0]+lm_head.weight.requires_grad_(requires_grad)- model.lm_head = lm_head+ model.set_output_embeddings(lm_head)+ if hasattr(model, "lm_head"): model.lm_head = lm_head+correct_dtype = lm_head.weight.dtypeelse:correct_dtype = old_input_embedding.dtype