code: def get_video_to_text_bpe_dataset_from_config(
      config,
      local_rank: int,
      global_rank: int,
      world_size: int,
      tokenizer,
      preprocessor_cfg: Optional[DictConfig] = None,
  ):
      """
      Construct Video-To-Text BPE dataset from a config.
      Args:
          config: BPE dataset config
          local_rank: model local rank
          global_rank: model global rand
          world_size: world size
          tokenizer: BPE tokenizer
          preprocessor_cfg: preprocessor config, for DALI BPE dataset
  
      Returns:
          constructed dataset or None if dataset config is invalid or nothing to load
      """
  
      is_concat = config.get("is_concat", False)
      if is_concat:
          if (
              "concat_sampling" in config
              and config["concat_sampling"] is None
          ):
              logging.warning(
                  f"Concat dataset requires `concat_sampling` but it was not provided. Config: {config}"
              )
              return None
  
          if not "concat_probabilities" in config:
              logging.warning(
                  f"Concat dataset requires `concat_probabilities` list but it was not provided. Config: {config}"
              )
              return None
          else:
              if not isclose(
                  sum(config["concat_probabilities"]), 1, abs_tol=1e-6
              ):
                  logging.warning(
                      f"`concat_probabilities` need to sum to 1. Config: {config}"
                  )
                  return None
  
      shuffle = config["shuffle"]
  
      # Instantiate tarred dataset loader or normal dataset loader
      if config.get("is_tarred", False):
          if (
              "tarred_audio_filepaths" in config
              and config["tarred_audio_filepaths"] is None
          ) or (
              "manifest_filepath" in config
              and config["manifest_filepath"] is None
          ):
              logging.warning(
                  "Could not load dataset as `manifest_filepath` was None or "
                  f"`tarred_audio_filepaths` is None. Provided config : {config}"
              )
              return None
  
          shuffle_n = (
              config.get("shuffle_n", 4 * config["batch_size"])
              if shuffle
              else 0
          )
          if is_concat:
              raise NotImplementedError(
                  "get_concat_tarred_dataset method not implemented"
              )
          else:
              dataset = get_tarred_dataset(
                  config=config,
                  tokenizer=tokenizer,
                  shuffle_n=shuffle_n,
                  global_rank=global_rank,
                  world_size=world_size,
              )
      else:
          if (
              "manifest_filepath" in config
              and config["manifest_filepath"] is None
          ):
              logging.warning(
                  f"Could not load dataset as `manifest_filepath` was None. Provided config : {config}"
              )
              return None
          if is_concat:
              raise NotImplementedError(
                  "get_concat_bpe_dataset method not implemented"
              )
          else:
              dataset = get_bpe_dataset(
                  config=config, tokenizer=tokenizer
              )
      return dataset
  
file_path: NeMo/nemo/collections/multimodal/speech_cv/data/video_to_text_dataset.py
imports: from math import isclose
  from typing import Optional
  from omegaconf import DictConfig
  from nemo.collections.asr.data.audio_to_text_dataset import convert_to_config_list, get_chain_dataset
  from nemo.collections.multimodal.speech_cv.data import video_to_text
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: get_video_to_text_bpe_dataset_from_config(config, local_rank, global_rank, world_size, tokenizer, preprocessor_cfg) and returns: dataset, None, None, None, None, None