code: def load_split_from_dmvr(
      ds_factory,
      dataset_configs,
      batch_size,
      subset="train",
      stride=2,
      num_test_clips=1,
      keep_key=False,
      max_num_captions: int = 1,
      caption_string="caption/string",
  ):
      """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.
        dataset_configs: Dataset configurations.
        batch_size: The batch_size to use.
        subset: train, validation or test.
        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.
        keep_key: bool; If true, also return the key for each example.
        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.
  
      Returns:
        A pair `(ds, num_examples)` with
          ds: A `tf.data.Dataset` object
          num_examples: Number of examples in the dataset.
      """
      # Should hold two fields: tokenizer_type and tokenizer_vocab.
      is_training = subset == "train"
      tokenizer_config = dataset_configs.get("tokenizer", {})
      tokenizer_type = tokenizer_config.get(
          "tokenizer_type", "sentence_piece"
      )
      tokenizer_model = tokenizer_config.get("tokenizer_model", None)
      modalities = dataset_configs.get("modalities", ["features"])
      num_frames = dataset_configs.get("num_frames", 100)
  
      if tokenizer_type == "sentence_piece":
          if tokenizer_model is not None:
              tokenizer = t5_tokenizer.build_dmvr_sp_model(
                  tokenizer_model
              )
          else:
              tokenizer = t5_tokenizer.build_dmvr_sp_model()
      else:
          raise NotImplementedError
  
      ds_factory = ds_factory(
          subset=subset, modalities=modalities
      ).configure(
          dataset_configs=dataset_configs,
          is_training=is_training,
          num_frames=num_frames,
          stride=stride,
          num_test_clips=num_test_clips,
          max_num_captions=max_num_captions,
          tokenizer=tokenizer,
          append_eos=True,
          caption_string=caption_string,
      )
  
      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 tokenizers
  from flax import jax_utils
  import jax
  import jax.numpy
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.projects.t5 import tokenizer
  from scenic.projects.vid2seq import data_utils
  from scenic.projects.vivit.data import video_tfrecord_dataset
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: load_split_from_dmvr(ds_factory, dataset_configs, batch_size, subset, stride, num_test_clips, keep_key, max_num_captions, caption_string) and returns: ds,  num_examples