code: def filter_repeats(pred_triples, pred_scores):
      # sort pred_triples and pred_scores by pred_scores
      score_sort_ids = sorted(
          enumerate(pred_scores), key=lambda x: x[1], reverse=True
      )
      pred_triples = [pred_triples[si[0]] for si in score_sort_ids]
      pred_scores = [
          score_sort_id[1] for score_sort_id in score_sort_ids
      ]
      all_pred_entities = {}
      all_pred_entities_pruned = []
      all_pred_scores_pruned = []
      for idx, ent in enumerate(pred_triples):
          if ent[0] in all_pred_entities:
              continue
          all_pred_entities_pruned.append(ent)
          all_pred_scores_pruned.append(pred_scores[idx])
          all_pred_entities[ent[0]] = 0
      return all_pred_entities_pruned, all_pred_scores_pruned
  
file_path: BLINK/scripts/tune_hyperparams_new.py
imports: import json
  import os
  import numpy
  import torch
  from elq.vcg_utils.measures import entity_linking_tp_with_overlap
  from tqdm import tqdm
  from transformers import BertTokenizer
label_desc: Use image node_id 2 for calling a global function with example usage: filter_repeats(pred_triples, pred_scores) and returns: all_pred_entities_pruned,  all_pred_scores_pruned