[Bugfix] Flatten >2D multimodal embeddings, not just 3D (#50250)
Signed-off-by: Michal Ganczarenko <michal.ganczarenko@intel.com>
Michał Ganczarenko committed
Aug 4, 2026 at 15:34 UTC
7c40d61eaf6bdd80bb493cf94032efbbe0ed0ee4
1 file changed
+2
-2
vllm/model_executor/models/transformers/multimodal.py
+2
-2
@@ -558,8 +558,8 @@ class MultiModalMixin(SupportsMultiModal, SupportsMRoPE):
558
total_expected = sum(split_sizes)
559
560
# Flatten to 2D: [total_tokens, hidden_dim]
561
- if embeddings.ndim == 3:
562
- embeddings = embeddings.view(-1, embeddings.shape[-1])
561
+ if embeddings.ndim > 2:
562
+ embeddings = embeddings.reshape(-1, embeddings.shape[-1])
563
564
total_tokens = embeddings.shape[0]
565
if total_tokens == total_expected: