songweig commited on
Commit
7c51507
1 Parent(s): ff191d6
Files changed (1) hide show
  1. utils/attention_utils.py +1 -1
utils/attention_utils.py CHANGED
@@ -665,7 +665,7 @@ def get_token_maps(selfattn_maps, crossattn_maps, n_maps, save_dir, width, heigh
665
  cross_attn_maps_1024).mean(0).cpu().numpy()
666
  normalized_span_maps = []
667
  for token_ids in obj_tokens:
668
- token_ids = [token_id for token_id in token_ids if token_id < 77]
669
  span_token_maps = cross_attn_maps_1024[:, :, token_ids.numpy()]
670
  normalized_span_map = np.zeros_like(span_token_maps)
671
  for i in range(span_token_maps.shape[-1]):
 
665
  cross_attn_maps_1024).mean(0).cpu().numpy()
666
  normalized_span_maps = []
667
  for token_ids in obj_tokens:
668
+ token_ids = torch.clip(token_ids, 0, 76)
669
  span_token_maps = cross_attn_maps_1024[:, :, token_ids.numpy()]
670
  normalized_span_map = np.zeros_like(span_token_maps)
671
  for i in range(span_token_maps.shape[-1]):