chanfee commited on
Commit
9705624
·
verified ·
1 Parent(s): 6b9a3f4

Update utils/model.py

Browse files
Files changed (1) hide show
  1. utils/model.py +2 -0
utils/model.py CHANGED
@@ -425,6 +425,8 @@ class OwlViTForClassification(nn.Module):
425
  print(f"position_embedding: {self.owlvit.text_model.embeddings.position_embedding(position_ids).shape}")
426
  print(f"text_embeds: {txt_embeds.shape}")
427
  print(f"pos + emb: {(txt_embeds + position_ids).shape}")
 
 
428
  text_embeds_parts = self.owlvit.text_model.get_text_features(**text_inputs_parts)
429
 
430
  # # Embed images and text queries
 
425
  print(f"position_embedding: {self.owlvit.text_model.embeddings.position_embedding(position_ids).shape}")
426
  print(f"text_embeds: {txt_embeds.shape}")
427
  print(f"pos + emb: {(txt_embeds + position_ids).shape}")
428
+ text_inputs_parts["position_ids"] = position_ids
429
+ position_ids = position_ids.repeat(1, 1, txt_embeds.size(-1) // position_ids.size(-1))
430
  text_embeds_parts = self.owlvit.text_model.get_text_features(**text_inputs_parts)
431
 
432
  # # Embed images and text queries