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
0a2f4c07
Unverified
Commit
0a2f4c07
authored
Aug 29, 2025
by
Lukas Geiger
Committed by
GitHub
Aug 29, 2025
Browse files
[Models] Use in-place adds in Idefics2Vision (#23932)
Signed-off-by:
Lukas Geiger
<
lukas.geiger94@gmail.com
>
parent
1cf3753b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
vllm/model_executor/models/idefics2_vision_model.py
vllm/model_executor/models/idefics2_vision_model.py
+3
-3
No files found.
vllm/model_executor/models/idefics2_vision_model.py
View file @
0a2f4c07
...
@@ -108,7 +108,7 @@ class Idefics2VisionEmbeddings(nn.Module):
...
@@ -108,7 +108,7 @@ class Idefics2VisionEmbeddings(nn.Module):
bucket_coords_w
).
flatten
()
bucket_coords_w
).
flatten
()
position_ids
[
batch_idx
][
p_attn_mask
.
view
(
-
1
).
cpu
()]
=
pos_ids
position_ids
[
batch_idx
][
p_attn_mask
.
view
(
-
1
).
cpu
()]
=
pos_ids
position_ids
=
position_ids
.
to
(
self
.
position_embedding
.
weight
.
device
)
position_ids
=
position_ids
.
to
(
self
.
position_embedding
.
weight
.
device
)
embeddings
=
embeddings
+
self
.
position_embedding
(
position_ids
)
embeddings
+
=
self
.
position_embedding
(
position_ids
)
return
embeddings
return
embeddings
...
@@ -262,11 +262,11 @@ class Idefics2EncoderLayer(nn.Module):
...
@@ -262,11 +262,11 @@ class Idefics2EncoderLayer(nn.Module):
residual
=
hidden_states
residual
=
hidden_states
hidden_states
=
self
.
layer_norm1
(
hidden_states
)
hidden_states
=
self
.
layer_norm1
(
hidden_states
)
hidden_states
=
self
.
self_attn
(
hidden_states
)
hidden_states
=
self
.
self_attn
(
hidden_states
)
hidden_states
=
residual
+
hidden_states
hidden_states
+
=
residual
residual
=
hidden_states
residual
=
hidden_states
hidden_states
=
self
.
layer_norm2
(
hidden_states
)
hidden_states
=
self
.
layer_norm2
(
hidden_states
)
hidden_states
=
self
.
mlp
(
hidden_states
)
hidden_states
=
self
.
mlp
(
hidden_states
)
hidden_states
=
residual
+
hidden_states
hidden_states
+
=
residual
return
hidden_states
return
hidden_states
...
...
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