class_docstr: Dataset that loads tensors via a json file containing paths to video
  files, transcripts, and durations (in seconds). Each new line is a
  different sample. Example below:
  {"video_filepath": "/path/to/video.mp4", "text_filepath":
  "/path/to/video.txt", "duration": 23.147}
  ...
  {"video_filepath": "/path/to/video.mp4", "text": "the
  transcription", "offset": 301.75, "duration": 0.82, "utt":
  "utterance_id", "ctm_utt": "en_4156", "side": "A"}
  
  In practice, the dataset and manifest used for character encoding and byte pair encoding
  are exactly the same. The only difference lies in how the dataset tokenizes the text in
  the manifest.
  
  Args:
      manifest_filepath: Path to manifest json as described above. Can
          be comma-separated paths.
      tokenizer: A subclass of the Tokenizer wrapper found in the common collection,
          nemo.collections.common.tokenizers.TokenizerSpec. ASR Models support a subset of
          all available tokenizers.
      int_values (bool): If true, load samples as 32-bit integers. Defauts to False.
      max_duration: If video exceeds this length, do not include in dataset
      min_duration: If video is less than this length, do not include
          in dataset
      max_utts: Limit number of utterances
      trim: Whether to trim silence segments
      use_start_end_token: Boolean which dictates whether to add [BOS] and [EOS]
          tokens to beginning and ending of speech respectively.
      return_sample_id (bool): whether to return the sample_id as a part of each sample
      channel_selector (int | Iterable[int] | str): select a single channel or a subset of channels from multi-channel audio. If set to `'average'`, it performs averaging across channels. Disabled if set to `None`. Defaults to `None`. Uses zero-based indexing.
class_docstr_tok: ["Dataset","that","loads","tensors","via","a","json","file","containing","paths","to","video","files",",","transcripts",",","and","durations","(","in","seconds",")",".","Each","new","line","is","a","different","sample",".","Example","below",":","{","``","video_filepath","''",":","``","\/path\/to\/video.mp4","''",",","``","text_filepath","''",":","''","\/path\/to\/video.txt","''",",","``","duration","''",":","23.147","}","...","{","``","video_filepath","''",":","``","\/path\/to\/video.mp4","''",",","``","text","''",":","``","the","transcription","''",",","``","offset","''",":","301.75",",","``","duration","''",":","0.82",",","``","utt","''",":","''","utterance_id","''",",","``","ctm_utt","''",":","``","en_4156","''",",","``","side","''",":","``","A","''","}","In","practice",",","the","dataset","and","manifest","used","for","character","encoding","and","byte","pair","encoding","are","exactly","the","same",".","The","only","difference","lies","in","how","the","dataset","tokenizes","the","text","in","the","manifest",".","Args",":","manifest_filepath",":","Path","to","manifest","json","as","described","above",".","Can","be","comma-separated","paths",".","tokenizer",":","A","subclass","of","the","Tokenizer","wrapper","found","in","the","common","collection",",","nemo.collections.common.tokenizers.TokenizerSpec",".","ASR","Models","support","a","subset","of","all","available","tokenizers",".","int_values","(","bool",")",":","If","true",",","load","samples","as","32-bit","integers",".","Defauts","to","False",".","max_duration",":","If","video","exceeds","this","length",",","do","not","include","in","dataset","min_duration",":","If","video","is","less","than","this","length",",","do","not","include","in","dataset","max_utts",":","Limit","number","of","utterances","trim",":","Whether","to","trim","silence","segments","use_start_end_token",":","Boolean","which","dictates","whether","to","add","[","BOS","]","and","[","EOS","]","tokens","to","beginning","and","ending","of","speech","respectively",".","return_sample_id","(","bool",")",":","whether","to","return","the","sample_id","as","a","part","of","each","sample","channel_selector","(","int","|","Iterable","[","int","]","|","str",")",":","select","a","single","channel","or","a","subset","of","channels","from","multi-channel","audio",".","If","set","to","`","'average","'","`",",","it","performs","averaging","across","channels",".","Disabled","if","set","to","`","None","`",".","Defaults","to","`","None","`",".","Uses","zero-based","indexing","."]
code: def __init__(
      self,
      manifest_filepath: str,
      tokenizer: "nemo.collections.common.tokenizers.TokenizerSpec",
      int_values: bool = False,
      max_duration: Optional[int] = None,
      min_duration: Optional[int] = None,
      max_utts: int = 0,
      trim: bool = False,
      use_start_end_token: bool = True,
      return_sample_id: bool = False,
      channel_selector: Optional[ChannelSelectorType] = None,
  ):
      if (
          use_start_end_token
          and hasattr(tokenizer, "bos_id")
          and tokenizer.bos_id > 0
      ):
          bos_id = tokenizer.bos_id
      else:
          bos_id = None
  
      if (
          use_start_end_token
          and hasattr(tokenizer, "eos_id")
          and tokenizer.eos_id > 0
      ):
          eos_id = tokenizer.eos_id
      else:
          eos_id = None
  
      if hasattr(tokenizer, "pad_id") and tokenizer.pad_id > 0:
          pad_id = tokenizer.pad_id
      else:
          pad_id = 0
  
      class TokenizerWrapper:
          def __init__(self, tokenizer):
              if isinstance(
                  tokenizer,
                  tokenizers.aggregate_tokenizer.AggregateTokenizer,
              ):
                  self.is_aggregate = True
              else:
                  self.is_aggregate = False
              self._tokenizer = tokenizer
  
          def __call__(self, *args):
              if isinstance(args[0], List) and self.is_aggregate:
                  t = []
                  for span in args[0]:
                      t.extend(
                          self._tokenizer.text_to_ids(
                              span["str"], span["lang"]
                          )
                      )
                  return t
  
              t = self._tokenizer.text_to_ids(*args)
              return t
  
      super().__init__(
          manifest_filepath=manifest_filepath,
          parser=TokenizerWrapper(tokenizer),
          int_values=int_values,
          max_duration=max_duration,
          min_duration=min_duration,
          max_utts=max_utts,
          bos_id=bos_id,
          eos_id=eos_id,
          pad_id=pad_id,
          trim=trim,
          return_sample_id=return_sample_id,
          channel_selector=channel_selector,
      )
  
imports: import os
  from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
  import torch
  import webdataset
  from nemo.collections.asr.data.audio_to_text import cache_datastore_manifests, expand_sharded_filepaths
  from nemo.collections.asr.parts.utils.audio_utils import ChannelSelectorType
  from nemo.collections.common import tokenizers
  from nemo.collections.common.parts.preprocessing import collections, parsers
  from nemo.collections.multimodal.speech_cv.parts.preprocessing.features import VideoFeaturizer
  from nemo.core.classes import Dataset, IterableDataset
  from nemo.core.neural_types import *
  from nemo.utils import logging
label_desc: Use image node_id 2 to create a new VideoToBPEDataset object from inherited base classes: _VideoTextDataset with example: obj = VideoToBPEDataset(manifest_filepath, tokenizer, int_values, max_duration, min_duration, max_utts, trim, use_start_end_token, return_sample_id, channel_selector)