chanfee commited on
Commit
1c1bbfd
·
verified ·
1 Parent(s): bb174ad

Update utils/model.py

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