code: def qa_metrics(targets, predictions):
      """Computes exact match and f1 QA scores, expecting pre-normalized text."""
      if len(targets) != len(predictions):
          raise ValueError(
              "Number of targets and predictions must match."
          )
      em = np.mean(
          [
              _metric_max_over_ground_truths(_exact_match_score, t, p)
              for p, t in zip(predictions, targets)
          ]
      )
      f1 = np.mean(
          [
              _metric_max_over_ground_truths(_f1_score, t, p)
              for p, t in zip(predictions, targets)
          ]
      )
      em *= 100
      f1 *= 100
      logging.info("EM = %.2f, F1 = %.2f", em, f1)
      return {"em": em, "f1": f1}
  
file_path: text-to-text-transfer-transformer/t5/evaluation/qa_utils.py
imports: import collections
  import re
  import string
  from absl import logging
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: qa_metrics(targets, predictions) and returns: dict