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
c3bb9f23
Unverified
Commit
c3bb9f23
authored
May 30, 2025
by
Lukas Geiger
Committed by
GitHub
May 30, 2025
Browse files
[Model] Use in-place adds in SigLIP (#18922)
Signed-off-by:
Lukas Geiger
<
lukas.geiger94@gmail.com
>
parent
8f8900ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
vllm/model_executor/models/siglip.py
vllm/model_executor/models/siglip.py
+6
-6
No files found.
vllm/model_executor/models/siglip.py
View file @
c3bb9f23
...
...
@@ -130,11 +130,10 @@ class SiglipVisionEmbeddings(nn.Module):
embeddings
=
patch_embeds
.
flatten
(
2
).
transpose
(
1
,
2
)
if
interpolate_pos_encoding
:
embeddings
=
embeddings
+
self
.
interpolate_pos_encoding
(
embeddings
+
=
self
.
interpolate_pos_encoding
(
embeddings
,
height
,
width
)
else
:
embeddings
=
embeddings
+
self
.
position_embedding
(
self
.
position_ids
)
embeddings
+=
self
.
position_embedding
(
self
.
position_ids
)
return
embeddings
...
...
@@ -271,12 +270,12 @@ class SiglipEncoderLayer(nn.Module):
hidden_states
=
self
.
layer_norm1
(
hidden_states
)
hidden_states
,
_
=
self
.
self_attn
(
hidden_states
=
hidden_states
)
hidden_states
=
residual
+
hidden_states
hidden_states
+
=
residual
residual
=
hidden_states
hidden_states
=
self
.
layer_norm2
(
hidden_states
)
hidden_states
=
self
.
mlp
(
hidden_states
)
hidden_states
=
residual
+
hidden_states
hidden_states
+
=
residual
return
hidden_states
,
None
...
...
@@ -354,7 +353,8 @@ class SiglipMultiheadAttentionPoolingHead(nn.Module):
residual
=
hidden_state
hidden_state
=
self
.
layernorm
(
hidden_state
)
hidden_state
=
residual
+
self
.
mlp
(
hidden_state
)
hidden_state
=
self
.
mlp
(
hidden_state
)
hidden_state
+=
residual
return
hidden_state
[:,
0
]
...
...
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