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:
co-authored by
kpham-sgl
Claude Fable 5.1
parent
87c9f78e99
commit
08b1922405
@@ -190,7 +190,8 @@ class Gemma4UnifiedForConditionalGeneration(Gemma4ForConditionalGeneration):
|
|||||||
)
|
)
|
||||||
|
|
||||||
text_tie = getattr(text_config, "tie_word_embeddings", True)
|
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
|
self.lm_head = self.language_model.embed_tokens
|
||||||
elif self.pp_group.is_last_rank:
|
elif self.pp_group.is_last_rank:
|
||||||
self.lm_head = ParallelLMHead(
|
self.lm_head = ParallelLMHead(
|
||||||
|
|||||||
Reference in New Issue
Block a user