fix(gemma4): set lm_head_is_tied for Gemma4UnifiedForConditionalGeneration (#35809)

Co-authored-by: kpham-sgl <khoa.pham@radixark.ai>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Yash Agarwal
2026-09-15 15:16:39 -07:00
committed by GitHub
co-authored by kpham-sgl Claude Fable 5.1
parent 87c9f78e99
commit 08b1922405
+2 -1
View File
@@ -190,7 +190,8 @@ class Gemma4UnifiedForConditionalGeneration(Gemma4ForConditionalGeneration):
)
text_tie = getattr(text_config, "tie_word_embeddings", True)
if self.pp_group.world_size == 1 and text_tie:
self.lm_head_is_tied = self.pp_group.world_size == 1 and text_tie
if self.lm_head_is_tied:
self.lm_head = self.language_model.embed_tokens
elif self.pp_group.is_last_rank:
self.lm_head = ParallelLMHead(