[V1][VLM] Fix edge case bug for InternVL2 (#11165)
Signed-off-by: Roger Wang <ywang@roblox.com>
This commit is contained in:
@@ -669,8 +669,11 @@ class InternVLChatModel(nn.Module, SupportsMultiModal, SupportsPP):
|
|||||||
image_embeds = self.extract_feature(image_input["data"])
|
image_embeds = self.extract_feature(image_input["data"])
|
||||||
|
|
||||||
patches_per_image = image_input["patches_per_image"]
|
patches_per_image = image_input["patches_per_image"]
|
||||||
|
|
||||||
|
# Only one image in the current batch
|
||||||
if len(patches_per_image) == 1:
|
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
|
return image_embeds
|
||||||
|
|
||||||
# NOTE: Image embeddings are split into separate tensors for each image
|
# NOTE: Image embeddings are split into separate tensors for each image
|
||||||
|
|||||||
Reference in New Issue
Block a user