@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / dc45efc8ef
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, 21:00 UTC

[BugFix] Fix Llama4 Pipeline Parallelism Assert Error (#28577)

Co-authored-by: Dezhan Tu <dztu@meta.com>

Dezhan committed Nov 20, 2025 at 02:52 UTC dc45efc8ef7fc1e2571331eaf4671e1652e2a865
1 file changed +7
vllm/model_executor/models/llama4.py
+7
@@ -53,6 +53,7 @@ from vllm.model_executor.models.utils import sequence_parallel_chunk
53 from .llama import LlamaForCausalLM, LlamaMLP, LlamaModel
54 from .utils import (
55 AutoWeightsLoader,
56 + PPMissingLayer,
57 extract_layer_index,
58 fast_topk,
59 is_pp_missing_parameter,
@@ -729,6 +730,9 @@ class Llama4ForCausalLM(LlamaForCausalLM, MixtureOfExperts):
730 self.moe_layers = []
731 example_moe = None
732 for layer in self.model.layers:
733 + if isinstance(layer, PPMissingLayer):
734 + continue
735 +
736 assert isinstance(layer, Llama4DecoderLayer)
737 if isinstance(layer.feed_forward, Llama4MoE):
738 # Pick last one layer since the first ones may be dense layers.
@@ -765,6 +769,9 @@ class Llama4ForCausalLM(LlamaForCausalLM, MixtureOfExperts):
769 self.num_local_physical_experts = num_local_physical_experts
770 self.num_redundant_experts = num_physical_experts - self.num_logical_experts
771 for layer in self.model.layers:
772 + if isinstance(layer, PPMissingLayer):
773 + continue
774 +
775 if isinstance(layer.feed_forward, Llama4MoE):
776 moe = layer.feed_forward
777 moe.n_local_physical_experts = num_local_physical_experts