Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
2e32f5d2
Unverified
Commit
2e32f5d2
authored
Dec 11, 2024
by
B-201
Committed by
GitHub
Dec 11, 2024
Browse files
[Bugfix] Fix Idefics3 fails during multi-image inference (#11080)
Signed-off-by:
B-201
<
Joy25810@foxmail.com
>
parent
61b1d2f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
vllm/model_executor/models/idefics3.py
vllm/model_executor/models/idefics3.py
+13
-8
No files found.
vllm/model_executor/models/idefics3.py
View file @
2e32f5d2
...
@@ -60,7 +60,8 @@ class Idefics3ImagePixelInputs(TypedDict):
...
@@ -60,7 +60,8 @@ class Idefics3ImagePixelInputs(TypedDict):
type
:
Literal
[
"pixel_values"
]
type
:
Literal
[
"pixel_values"
]
data
:
torch
.
Tensor
data
:
torch
.
Tensor
"""
"""
Shape: `(batch_size * num_images, num_channels, height, width)`
Shape: `(batch_size * num_images * num_patches,
num_channels, height, width)`
"""
"""
pixel_attention_mask
:
Optional
[
torch
.
BoolTensor
]
pixel_attention_mask
:
Optional
[
torch
.
BoolTensor
]
...
@@ -520,13 +521,17 @@ class Idefics3Model(nn.Module):
...
@@ -520,13 +521,17 @@ class Idefics3Model(nn.Module):
raise
ValueError
(
"Incorrect type of pixel values. "
raise
ValueError
(
"Incorrect type of pixel values. "
f
"Got type:
{
type
(
pixel_values
)
}
"
)
f
"Got type:
{
type
(
pixel_values
)
}
"
)
return
Idefics3ImagePixelInputs
(
type
=
"pixel_values"
,
if
isinstance
(
pixel_values
,
list
):
data
=
self
.
_validate_pixel_values
(
pixel_values
=
torch
.
cat
(
pixel_values
,
dim
=
1
)
flatten_bn
(
pixel_values
,
pixel_attention_mask
=
torch
.
cat
(
pixel_attention_mask
,
dim
=
1
)
concat
=
True
)),
else
:
pixel_attention_mask
=
flatten_bn
(
pixel_values
=
flatten_bn
(
pixel_values
)
pixel_attention_mask
,
pixel_attention_mask
=
flatten_bn
(
pixel_attention_mask
)
concat
=
True
))
return
Idefics3ImagePixelInputs
(
type
=
"pixel_values"
,
data
=
self
.
_validate_pixel_values
(
pixel_values
),
pixel_attention_mask
=
pixel_attention_mask
)
raise
AssertionError
(
"This line should be unreachable."
)
raise
AssertionError
(
"This line should be unreachable."
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment