mirror of
https://github.com/vllm-project/vllm.git
synced 2025-10-20 14:53:52 +08:00
[Models] Use in-place adds in Idefics2Vision (#23932)
Signed-off-by: Lukas Geiger <lukas.geiger94@gmail.com>
This commit is contained in:
@ -108,7 +108,7 @@ class Idefics2VisionEmbeddings(nn.Module):
|
||||
bucket_coords_w).flatten()
|
||||
position_ids[batch_idx][p_attn_mask.view(-1).cpu()] = pos_ids
|
||||
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
|
||||
|
||||
|
||||
@ -262,11 +262,11 @@ class Idefics2EncoderLayer(nn.Module):
|
||||
residual = hidden_states
|
||||
hidden_states = self.layer_norm1(hidden_states)
|
||||
hidden_states = self.self_attn(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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user