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
e5949e5a
Unverified
Commit
e5949e5a
authored
Aug 03, 2025
by
Chenxi Yang
Committed by
GitHub
Aug 03, 2025
Browse files
Remove index_put from MM embeddings merging (#22105)
Co-authored-by:
Chenxi Yang
<
cxyang@meta.com
>
parent
49bcd893
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
18 deletions
+24
-18
vllm/model_executor/models/utils.py
vllm/model_executor/models/utils.py
+24
-18
No files found.
vllm/model_executor/models/utils.py
View file @
e5949e5a
...
@@ -418,17 +418,23 @@ def _merge_multimodal_embeddings(
...
@@ -418,17 +418,23 @@ def _merge_multimodal_embeddings(
Note:
Note:
This updates ``inputs_embeds`` in place.
This updates ``inputs_embeds`` in place.
"""
"""
flattened
=
_flatten_embeddings
(
multimodal_embeddings
)
try
:
# This is equivalent to: inputs_embeds[is_multimodal] = flattened.
inputs_embeds
.
masked_scatter_
(
is_multimodal
.
unsqueeze
(
-
1
),
flattened
)
except
RuntimeError
as
e
:
num_expected_tokens
=
is_multimodal
.
sum
().
item
()
num_expected_tokens
=
is_multimodal
.
sum
().
item
()
assert
isinstance
(
num_expected_tokens
,
int
)
assert
isinstance
(
num_expected_tokens
,
int
)
flattened
=
_flatten_embeddings
(
multimodal_embeddings
)
if
flattened
.
shape
[
0
]
!=
num_expected_tokens
:
if
flattened
.
shape
[
0
]
!=
num_expected_tokens
:
expr
=
_embedding_count_expression
(
multimodal_embeddings
)
expr
=
_embedding_count_expression
(
multimodal_embeddings
)
raise
ValueError
(
raise
ValueError
(
f
"Attempted to assign
{
expr
}
=
{
flattened
.
shape
[
0
]
}
"
f
"Attempted to assign
{
expr
}
=
{
flattened
.
shape
[
0
]
}
"
f
"multimodal tokens to
{
num_expected_tokens
}
placeholders"
)
f
"multimodal tokens to
{
num_expected_tokens
}
placeholders"
)
from
e
else
:
raise
ValueError
(
"Error during masked scatter operation"
)
from
e
inputs_embeds
[
is_multimodal
]
=
flattened
return
inputs_embeds
return
inputs_embeds
...
...
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