code: def get_coco_captions():
      """Extracts coco's captions from nested dict."""
  
      def _pp_coco_captions(captions, sample=False):
          t = captions["text"]
          if sample:
              ts = tf.concat([t, [""]], axis=0)
              num_texts = tf.reduce_max([tf.shape(ts)[0] - 1, 1])
              idx = tf.random.uniform([], 0, num_texts, dtype=tf.int16)
          else:
              idx = tf.argmax(tf.strings.length(t))
          return tf.reshape(tf.strings.lower(t[idx]), (-1,))
  
      return _pp_coco_captions
  
imports: import functools
  from big_vision.datasets.imagenet import class_names
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib.big_transfer import registry
  from scenic.dataset_lib.big_transfer.preprocessing import utils
  from scenic.projects.t5 import tokenizer
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: get_coco_captions() and returns: _pp_coco_captions, tf