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
ed636d99
Unverified
Commit
ed636d99
authored
Apr 07, 2025
by
Roger Wang
Committed by
GitHub
Apr 07, 2025
Browse files
[Misc] Move Llama 4 projector call into encoder execution (#16201)
parent
090c856d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
vllm/model_executor/models/mllama4.py
vllm/model_executor/models/mllama4.py
+4
-3
No files found.
vllm/model_executor/models/mllama4.py
View file @
ed636d99
...
@@ -760,6 +760,8 @@ class Llama4ForConditionalGeneration(nn.Module, SupportsMultiModal,
...
@@ -760,6 +760,8 @@ class Llama4ForConditionalGeneration(nn.Module, SupportsMultiModal,
flat_data
=
image_input
[
"flat_data"
]
flat_data
=
image_input
[
"flat_data"
]
patches_per_image
=
image_input
[
"patches_per_image"
].
tolist
()
patches_per_image
=
image_input
[
"patches_per_image"
].
tolist
()
vision_embeddings_flat
=
self
.
vision_model
(
flat_data
)
vision_embeddings_flat
=
self
.
vision_model
(
flat_data
)
vision_embeddings_flat
=
self
.
multi_modal_projector
(
vision_embeddings_flat
)
return
vision_embeddings_flat
.
split
(
patches_per_image
,
dim
=
0
)
return
vision_embeddings_flat
.
split
(
patches_per_image
,
dim
=
0
)
def
get_multimodal_embeddings
(
self
,
def
get_multimodal_embeddings
(
self
,
...
@@ -791,10 +793,9 @@ class Llama4ForConditionalGeneration(nn.Module, SupportsMultiModal,
...
@@ -791,10 +793,9 @@ class Llama4ForConditionalGeneration(nn.Module, SupportsMultiModal,
inputs_embeds
=
self
.
language_model
.
get_input_embeddings
(
input_ids
)
inputs_embeds
=
self
.
language_model
.
get_input_embeddings
(
input_ids
)
if
multimodal_embeddings
is
not
None
:
if
multimodal_embeddings
is
not
None
:
multimodal_embeddings
=
torch
.
cat
(
multimodal_embeddings
)
mm_embeddings
=
self
.
multi_modal_projector
(
multimodal_embeddings
)
inputs_embeds
=
merge_multimodal_embeddings
(
inputs_embeds
=
merge_multimodal_embeddings
(
input_ids
,
inputs_embeds
,
select_patch_features
(
mm_embeddings
),
input_ids
,
inputs_embeds
,
select_patch_features
(
multimodal_embeddings
),
self
.
config
.
image_token_index
)
self
.
config
.
image_token_index
)
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