Unverified Commit 969da7d7 authored by Roger Wang's avatar Roger Wang Committed by GitHub
Browse files

[V1][VLM] Fix edge case bug for InternVL2 (#11165)


Signed-off-by: default avatarRoger Wang <ywang@roblox.com>
parent eeec9e33
......@@ -669,8 +669,11 @@ class InternVLChatModel(nn.Module, SupportsMultiModal, SupportsPP):
image_embeds = self.extract_feature(image_input["data"])
patches_per_image = image_input["patches_per_image"]
# Only one image in the current batch
if len(patches_per_image) == 1:
image_embeds = image_embeds.unsqueeze(0)
image_embeds = image_embeds.view(
-1, self.config.text_config.hidden_size).unsqueeze(0)
return image_embeds
# NOTE: Image embeddings are split into separate tensors for each image
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment