Fix Tensor + Embedding error in some cases when using SiglipVisionModel (#33994)

Fix Tensor + Embedding error in some cases

Co-authored-by: kaitolucifer <kaito.o@ghelia.com>
This commit is contained in:
Kaito 2024-10-07 18:17:34 +09:00 committed by GitHub
parent 9b4b0c07db
commit e782e95e34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -283,7 +283,7 @@ class SiglipVisionEmbeddings(nn.Module):
# 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
return self.position_embedding(self.position_ids)
patch_pos_embed = self.position_embedding