Signed-off-by: Anish Kumar <aniskumar@nvidia.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Cyrus Leung
Claude Fable 5.1
parent
4187ade7b8
commit
775792f2d5
@@ -568,6 +568,15 @@ class NemotronParseForConditionalGeneration(nn.Module, SupportsMultiModal):
|
||||
self.lm_head = ParallelLMHead(
|
||||
config.decoder.vocab_size, config.decoder.d_model, quant_config=quant_config
|
||||
)
|
||||
# Some checkpoints (e.g. compact exports) tie the output head to the
|
||||
# decoder's input embeddings instead of materializing a separate
|
||||
# lm_head.weight tensor.
|
||||
tie_word_embeddings = bool(
|
||||
getattr(config, "tie_word_embeddings", False)
|
||||
or getattr(config.decoder, "tie_word_embeddings", False)
|
||||
)
|
||||
if tie_word_embeddings:
|
||||
self.lm_head = self.lm_head.tie_weights(self.decoder.embed_tokens)
|
||||
self.logits_processor = LogitsProcessor(
|
||||
self.vocab_size, config.decoder.vocab_size
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user