code: def load_split_from_dmvr(
      ds_factory,
      batch_size,
      subset="train",
      num_frames=32,
      stride=2,
      num_test_clips=1,
      min_resize=256,
      crop_size=224,
      zero_centering=True,
      augmentation_params=None,
      keep_key=False,
      max_num_words: int = 16,
      max_num_captions: int = 1,
      caption_string="caption/string",
      num_labels=0,
      include_verb: bool = False,
  ):
      """Loads dataset using DMVR for pre-processing.
  
      DMVR dataset loader already does basic augmentation (random crop and flip in
        train mode. It also already shuffles and batches the data.
  
      Args:
        ds_factory: A DMVR factory to instantiate with the subset.
        batch_size: The batch_size to use.
        subset: train, validation or test.
        num_frames: Number of RGB frames per subclip.
        stride: Temporal stride to sample RGB frames.
        num_test_clips: Number of test clips (1 by default). If more than 1, this
          will sample multiple linearly spaced clips within each video at test time.
          If 1, then a single clip in the middle of the video is sampled. The clips
          are aggreagated in the batch dimension.
        min_resize: Frames are resized so that min(height, width) is min_resize.
        crop_size: Final size of the frame after cropping the resized frames. Both
          height and width are the same.
        zero_centering: If True, frames are normalized to values in [-1, 1]. If
          False, values in [0, 1].
        augmentation_params: dict; augmentation configurations in train mode.
        keep_key: bool; If true, also return the key for each example.
        max_num_words: Maximum number of tokens to keep from the text for each
          caption. If there are more tokens, sequence is cropped, if less, the
          caption is padded using the tokenizer pad id.
        max_num_captions: Maximum number of captions to keep. If there are more
          captions in the proto, only the first `max_num_captions` will be returned
          is `is_training` is set to `False`. If `is_training` is `True`, then
          `max_num_captions` will be randomly sampled. Finally if the proto contains
          less than `max_num_captions`, we pad with empty srings to make sure there
          are `max_num_captions` in total.
        caption_string: Input feature name in sstable for caption.
        num_labels: Number of labels (classification).
        include_verb: verb phrase loss.
  
      Returns:
        A pair `(ds, num_examples)` with
          ds: A `tf.data.Dataset` object
          num_examples: Number of examples in the dataset.
      """
      is_training = subset == "train"
      ds_factory = ds_factory(subset=subset).configure(
          is_training=is_training,
          num_frames=num_frames,
          stride=stride,
          num_test_clips=num_test_clips,
          min_resize=min_resize,
          crop_size=crop_size,
          zero_centering_image=zero_centering,
          max_num_words=max_num_words,
          max_num_captions=max_num_captions,
          caption_string=caption_string,
          num_labels=num_labels,
          include_verb=include_verb,
      )
  
      if is_training and augmentation_params:
          # additional augmentation for the RGB features.
          ds_factory = video_ops.additional_augmentations(
              ds_factory,
              augmentation_params,
              crop_size,
              num_frames,
              zero_centering,
          )
  
      logging.info(
          "Preprocessing graph: %s",
          ds_factory.preprocessor_builder.get_summary(),
      )
      logging.info(
          "Postprocessing graph: %s",
          ds_factory.postprocessor_builder.get_summary(),
      )
      num_examples = ds_factory.num_examples
      ds = ds_factory.make_dataset(
          batch_size=batch_size,
          shuffle=is_training,
          num_epochs=None if is_training else 1,
          drop_remainder=is_training,
          keep_key=(not is_training and keep_key),
      )
      if not is_training:
          ds = ds.repeat(None)
      options = tf.data.Options()
      options.experimental_threading.private_threadpool_size = 48
      ds = ds.with_options(options)
      return ds, num_examples
  
imports: import functools
  from typing import Dict, Iterator, List, Optional, Text, Tuple, Union
  from absl import logging
  from dmvr import modalities
  from flax import jax_utils
  import jax
  import jax.numpy
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  from scenic.dataset_lib import video_ops
  from scenic.projects.baselines.clip import tokenizer
  from scenic.projects.vivit.data import video_tfrecord_dataset
  import tensorflow
  from dmvr import tokenizers
label_desc: Use image node_id 2 for calling a global function with example usage: load_split_from_dmvr(ds_factory, batch_size, subset, num_frames, stride, num_test_clips, min_resize, crop_size, zero_centering, augmentation_params, keep_key, max_num_words, max_num_captions, caption_string, num_labels, include_verb) and returns: ds,  num_examples