Skip to content

Commit

Permalink
properly fix and RUN_SLOW (#33965)
Browse files Browse the repository at this point in the history
* properly fix and RUN_SLOW

* lots of models were affected

* fix-copies

* more fixes
  • Loading branch information
ArthurZucker committed Oct 7, 2024
1 parent 6ea04aa commit ae5f491
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/transformers/models/siglip/modeling_siglip.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@ def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width:
"""

num_patches = embeddings.shape[1]
num_positions = self.position_embedding.shape[1]
num_positions = self.position_embedding.weight.shape[0]

# always interpolate when tracing to ensure the exported model works for dynamic input shapes
if not torch.jit.is_tracing() and num_patches == num_positions and height == width:
return self.position_embedding

patch_pos_embed = self.position_embedding
patch_pos_embed = self.position_embedding.weight.unsqueeze(0)

dim = embeddings.shape[-1]

Expand Down

0 comments on commit ae5f491

Please sign in to comment.