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 9, 08:45 UTC
[BUGFIX] Pixtral cannot be loaded with --limit-mm-per-prompt 0 (#33406)
Signed-off-by: juliendenize <julien.denize@mistral.ai>
Julien Denize committed
Jan 30, 2026 at 11:52 UTC
8e2ad97ad0078f259a32e99902c90234d30c2ef4
1 file changed
+9
-5
vllm/model_executor/models/pixtral.py
+9
-5
@@ -70,7 +70,7 @@ from .interfaces import (
70
SupportsPP,
71
)
72
from .module_mapping import MultiModelKeys
73
-from .utils import init_vllm_registered_model, maybe_prefix
73
+from .utils import StageMissingLayer, init_vllm_registered_model, maybe_prefix
74
from .vision import (
75
VisionEncoderInfo,
76
VisionFeatureSelectStrategy,
@@ -93,6 +93,10 @@ except ImportError:
93
PATCH_MERGE = "patch_merge"
94
95
96
+def _is_layer_none_or_staged(layer: nn.Module) -> bool:
97
+ return layer is None or isinstance(layer, StageMissingLayer)
98
+
99
+
100
class PixtralImagePixelInputs(TensorSchema):
101
"""
102
Dimensions:
@@ -542,7 +546,7 @@ class PixtralForConditionalGeneration(
546
# Single pass over weights
547
for name, w in weights:
548
if is_vision_encoder_weights((name, w)):
545
- if self.vision_encoder is None:
549
+ if _is_layer_none_or_staged(self.vision_encoder):
550
continue
551
# Load vision encoder weights directly
552
trimmed_name = ".".join(name.split(".")[1:])
@@ -551,7 +555,7 @@ class PixtralForConditionalGeneration(
555
with torch.no_grad():
556
default_weight_loader(param, w)
557
elif is_patch_merger((name, w)):
554
- if self.patch_merger is None:
558
+ if _is_layer_none_or_staged(self.patch_merger):
559
continue
560
# Load vision patch merger weights directly
561
trimmed_name = ".".join(name.split(".")[1:])
@@ -559,7 +563,7 @@ class PixtralForConditionalGeneration(
563
with torch.no_grad():
564
default_weight_loader(param, w)
565
elif is_pre_mm_projector_norm((name, w)):
562
- if self.pre_mm_projector_norm is None:
566
+ if _is_layer_none_or_staged(self.pre_mm_projector_norm):
567
continue
568
# Load vision pre_mm_projector_norm weights directly
569
trimmed_name = ".".join(name.split(".")[1:])
@@ -567,7 +571,7 @@ class PixtralForConditionalGeneration(
571
with torch.no_grad():
572
default_weight_loader(param, w)
573
elif is_vision_lang_adapter_weights((name, w)):
570
- if self.vision_language_adapter is None:
574
+ if _is_layer_none_or_staged(self.vision_language_adapter):
575
continue
576
# Load vision-language adapter weights directly
577
trimmed_name = ".".join(name.split(".")[1:])