code: def compute_metrics_from_files(
      path_to_reference, path_to_candidate, perform_checks=True
  ):
      """Compute MRR metric
      Args:
      p_path_to_reference_file (str): path to reference file.
          Reference file should contain lines in the following format:
              QUERYID\tPASSAGEID
              Where PASSAGEID is a relevant passage for a query. Note QUERYID can repeat on different lines with different PASSAGEIDs
      p_path_to_candidate_file (str): path to candidate file.
          Candidate file sould contain lines in the following format:
              QUERYID\tPASSAGEID1\tRank
              If a user wishes to use the TREC format please run the script with a -t flag at the end. If this flag is used the expected format is
              QUERYID\tITER\tDOCNO\tRANK\tSIM\tRUNID
              Where the values are separated by tabs and ranked in order of relevance
      Returns:
          dict: dictionary of metrics {'MRR': <MRR Score>}
      """
  
      qids_to_relevant_passageids = load_reference(path_to_reference)
      qids_to_ranked_candidate_passages = load_candidate(
          path_to_candidate
      )
      if perform_checks:
          allowed, message = quality_checks_qids(
              qids_to_relevant_passageids,
              qids_to_ranked_candidate_passages,
          )
          if message != "":
              print(message)
  
      return compute_metrics(
          qids_to_relevant_passageids, qids_to_ranked_candidate_passages
      )
  
file_path: FARM/farm/evaluation/msmarco_passage_official.py
imports: import sys
  import statistics
  from collections import Counter
label_desc: Use image node_id 7 for calling a global function with example usage: compute_metrics_from_files(path_to_reference, path_to_candidate, perform_checks) and returns: compute_metrics