@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 51c57b51dd
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 12, 04:45 UTC

[Bugfix] Fix DeepSeek R1 MTP weight loading (#29545)

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Co-authored-by: Benjamin Chislett <bchislett@nvidia.com>

Matthew Bonanni committed Dec 2, 2025 at 10:52 UTC 51c57b51dd51d87715367850faae1da7a9cabaef
1 file changed +11
vllm/model_executor/models/deepseek_mtp.py
+11
@@ -346,11 +346,16 @@ class DeepSeekMTP(nn.Module, SupportsPP, DeepseekV2MixtureOfExperts):
346 # Use expert_params_mapping to locate the destination
347 # param and delegate to its expert-aware weight_loader
348 # with expert_id.
349 + is_expert_weight = False
350 for mapping in expert_params_mapping:
351 param_name, weight_name, expert_id, shard_id = mapping
352 if weight_name not in chunk_name:
353 continue
354
355 + # Anyway, this is an expert weight and should not be
356 + # attempted to load as other weights later
357 + is_expert_weight = True
358 +
359 # Do not modify `name` since the loop may continue here
360 # Instead, create a new variable
361 name_mapped = chunk_name.replace(weight_name, param_name)
@@ -377,6 +382,12 @@ class DeepSeekMTP(nn.Module, SupportsPP, DeepseekV2MixtureOfExperts):
382 loaded_params.add(name_mapped)
383 break
384 else:
385 + if is_expert_weight:
386 + # We've checked that this is an expert weight
387 + # However it's not mapped locally to this rank
388 + # So we simply skip it
389 + continue
390 +
391 # Skip loading extra bias for GPTQ models.
392 if name.endswith(".bias") and name not in params_dict:
393 continue