From e6fc848d4ff2d00759516b0c7a47ba640d44e4b2 Mon Sep 17 00:00:00 2001 From: Parth Ashwin Jain <149461152+parthash0804@users.noreply.github.com> Date: Tue, 9 Jun 2026 11:58:26 +0530 Subject: [PATCH] [Bugfix][MiniCPM-o] Fix cuda/cpu device mismatch in Resampler2_5 pos_embed (#43844) Signed-off-by: Parth Ashwin Jain Co-authored-by: Parth Ashwin Jain Co-authored-by: Cyrus Leung Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- vllm/model_executor/models/minicpmv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/models/minicpmv.py b/vllm/model_executor/models/minicpmv.py index 001329b176..add63e169f 100644 --- a/vllm/model_executor/models/minicpmv.py +++ b/vllm/model_executor/models/minicpmv.py @@ -217,7 +217,9 @@ class Resampler2_5(BaseResampler): for i in range(bs): tgt_h, tgt_w = tgt_sizes[i].tolist() pos_embed.append( - self.pos_embed[:tgt_h, :tgt_w, :].reshape((tgt_h * tgt_w, -1)).to(dtype) + self.pos_embed[:tgt_h, :tgt_w, :] + .reshape((tgt_h * tgt_w, -1)) + .to(device=device, dtype=dtype) ) # patches * D key_padding_mask[i, patch_len[i] :] = True pos_embed = torch.nn.utils.rnn.pad_sequence(