code: def multirc_f1_over_all_answers(targets, predictions):
      """Special metric for MultiRC which computes F1 score over all examples.
  
      This is necessary because the targets/predictions for MultiRC are dicts and
      the f1_score_with_invalid expects a list of True/False labels, not dicts. As
      a result we just need to key in the "value" for each of the example dicts
      before feeding into f1_score_with_invalid.
  
      Args:
        targets: list of dicts, where each dict has a "value" key.
        predictions: list of dicts, where each dict has a "value" key.
  
      Returns:
        F1 score over values, where any prediction != 0 or 1 is counted as wrong.
      """
      return f1_score_with_invalid(
          [t["value"] for t in targets],
          [p["value"] for p in predictions],
      )
  
imports: import collections
  import itertools
  import re
  import string
  from typing import Any, Dict, Mapping, Optional, Sequence, Tuple, Union
  from absl import logging
  import editdistance
  import flax
  import jax.numpy
  import numpy
  import sacrebleu
  import scipy.stats
  import seqio
  import sklearn.metrics
  from t5.evaluation import qa_utils
  import tensorflow.compat.v2
  from rouge_score import rouge_scorer
  from rouge_score import scoring
label_desc: Use image node_id 17 for calling a global function with example usage: multirc_f1_over_all_answers(targets, predictions) and returns: f1_score_with_invalid