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 6, 17:00 UTC
Fix text only inputs for MRoPE models with the Transformers modelling backend (#37055)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Harry Mellor committed
Mar 16, 2026 at 10:31 UTC
ad041c79db4a6e99b28c9ba78cce02435b35fd2d
1 file changed
+14
-13
vllm/model_executor/models/transformers/multimodal.py
+14
-13
@@ -448,20 +448,21 @@ class MultiModalMixin(SupportsMultiModal, SupportsMRoPE):
448
# In v4 `get_rope_index` doesn't have wildcard `kwargs`, and
449
# can't accept arbitrary args, even if its value is `None`
450
kwargs = {}
451
- if mm_token_type_ids:
452
- if not hasattr(self, "_get_rope_index_accepts_mm_token_type_ids"):
453
- import inspect
454
-
455
- sig = inspect.signature(self.model.get_rope_index)
456
- params = sig.parameters
457
- self._get_rope_index_accepts_mm_token_type_ids = (
458
- "mm_token_type_ids" in params
459
- or any(
460
- p.kind == inspect.Parameter.VAR_KEYWORD for p in params.values()
461
- )
462
- )
463
- if self._get_rope_index_accepts_mm_token_type_ids:
451
+ if not hasattr(self, "_get_rope_index_accepts_mm_token_type_ids"):
452
+ import inspect
453
+
454
+ sig = inspect.signature(self.model.get_rope_index)
455
+ params = sig.parameters
456
+ self._get_rope_index_accepts_mm_token_type_ids = (
457
+ "mm_token_type_ids" in params
458
+ or any(p.kind == inspect.Parameter.VAR_KEYWORD for p in params.values())
459
+ )
460
+ if self._get_rope_index_accepts_mm_token_type_ids:
461
+ if mm_token_type_ids:
462
kwargs["mm_token_type_ids"] = torch.cat(mm_token_type_ids)
463
+ else:
464
+ shape = (1, len(input_tokens))
465
+ kwargs["mm_token_type_ids"] = torch.zeros(*shape, dtype=torch.int)
466
467
mrope_positions, mrope_position_delta = self.model.get_rope_index(
468
input_ids=torch.tensor(input_tokens).unsqueeze(0),