Standardise weight tying on ParallelLMHead.tie_weights (#52147)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-08-13 15:10:09 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 7553aac77b
commit 80d6d557f3
56 changed files with 191 additions and 214 deletions
+7 -8
View File
@@ -1340,15 +1340,14 @@ class MolmoForCausalLM(
self.img_patch_id = None
self.lm_head = ParallelLMHead(
config.embedding_size or config.vocab_size,
config.hidden_size,
quant_config=quant_config,
prefix=maybe_prefix(prefix, "lm_head"),
)
if self.config.weight_tying:
self.lm_head = self.model.transformer.wte
else:
self.lm_head = ParallelLMHead(
config.embedding_size or config.vocab_size,
config.hidden_size,
quant_config=quant_config,
prefix=maybe_prefix(prefix, "lm_head"),
)
self.lm_head = self.lm_head.tie_weights(self.model.transformer.wte)
self.logits_processor = LogitsProcessor(
config.embedding_size or config.vocab_size