Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions vllm/models/deepseek_v4/nvidia/dspark.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,21 +700,25 @@ def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
self.max_batch = max(1, int(vllm_config.scheduler_config.max_num_seqs))
hidden_size = int(config.hidden_size)
dtype = vllm_config.model_config.dtype
quant_config = get_draft_quant_config(vllm_config)
self.quant_config = get_draft_quant_config(vllm_config)
self.pad_shared_expert = (
getattr(self.quant_config, "weight_block_size", None) is not None
and not vllm_config.parallel_config.use_sequence_parallel_moe
)
self.dspark_aux_hidden_size = hidden_size * len(self.target_layer_ids)

self.embed_tokens = VocabParallelEmbedding(
config.vocab_size,
hidden_size,
quant_config=quant_config,
quant_config=self.quant_config,
prefix=f"{prefix}embed_tokens",
)
self.main_proj = ReplicatedLinear(
self.dspark_aux_hidden_size,
hidden_size,
bias=False,
params_dtype=dtype,
quant_config=quant_config,
quant_config=self.quant_config,
prefix=f"{prefix}mtp.0.main_proj",
return_bias=False,
)
Expand Down Expand Up @@ -1044,6 +1048,12 @@ def map_name(name: str) -> str | None:
else ".weight_scale_inv"
)
name = name.removesuffix(".scale") + suffix
if ".shared_experts.w2" in name:
name = name.replace(".shared_experts.w2", ".shared_experts.down_proj")
if self.pad_shared_expert and ".shared_experts." in name:
loaded_weight = DeepseekV4Model._pad_shared_expert_weight(
self.quant_config, name, loaded_weight
)
for param_name, weight_name, shard_id in stacked_params_mapping:
if not name.startswith("layers."):
continue
Expand Down