Skip to content

Commit 1f90308

Browse files
hmellorAkshat-Tripathi
authored andcommitted
DeepSeek V2/V3/R1 only place lm_head on last pp rank (vllm-project#13833)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
1 parent 5b754aa commit 1f90308

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

vllm/model_executor/models/deepseek_v2.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,12 @@ def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
636636
self.quant_config = quant_config
637637
self.model = DeepseekV2Model(vllm_config=vllm_config,
638638
prefix=maybe_prefix(prefix, "model"))
639-
self.lm_head = ParallelLMHead(config.vocab_size,
640-
config.hidden_size,
641-
quant_config=quant_config)
639+
if get_pp_group().is_last_rank:
640+
self.lm_head = ParallelLMHead(config.vocab_size,
641+
config.hidden_size,
642+
quant_config=quant_config)
643+
else:
644+
self.lm_head = PPMissingLayer()
642645
self.logits_processor = LogitsProcessor(config.vocab_size)
643646
self.sampler = get_sampler()
644647
self.make_empty_intermediate_tensors = (

0 commit comments

Comments
 (0)