class_docstr: Reader for TFRecords using the MediaSequence format.
  
  The TFrecords already contain images and spectrograms.
class_docstr_tok: ["Reader","for","TFRecords","using","the","MediaSequence","format",".","The","TFrecords","already","contain","images","and","spectrograms","."]
docstr: Initializes the instance of AVSSTableDatasetFactory.
  
  Initializes a data-loader using DeepMind Video Reader (DMVR) pre-processing.
  TFrecords are assumed to consist of tf.SequenceExample protocol buffers in
  the MediaSequence format
  (https://github.com/google/mediapipe/tree/master/mediapipe/util/sequence).
  
  Args:
    base_dir: The base directory of the TFrecords.
    tables: A dictionary mapping the subset name (train, val or test) to the
      relative path of the SSTable containing them. Follows DMVR convention.
      The values of the dictionary can either be a string or a list. If it is
      a string, it specifies all the shards in the SSTable. Example -
      "/path/to/tfrecord@10". If passing a list, each entry is a shard of the
      TFRecord. Example - "[/path/to/sstable_shard_1_of_10, ...,
      /path/to/sstabble_shard_10_of_10]." The latter scenario is useful for
      debugging.
    subset: The subset of the dataset to load. Must be a key of "tables"
    modalities: Which modality to load. Currently supports 'rgb' and
      'spectrogram'
    prop_data: The proportion of the data to load. If less than 1.0, this
      proportion of the total SSTable shards are read.
    num_groups: If specified will reshard the data according to `num_groups`.
      A `group_index` should be specified if using `num_groups`.
    group_index: Index of the shard to return after resharding. `num_groups`
      should be specified if using `group_index`. This is useful in
      distributed setting where one wants to ensure that different data is
      read by different workers.
docstr_tok: ["Initializes","the","instance","of","AVSSTableDatasetFactory",".","Initializes","a","data-loader","using","DeepMind","Video","Reader","(","DMVR",")","pre-processing",".","TFrecords","are","assumed","to","consist","of","tf.SequenceExample","protocol","buffers","in","the","MediaSequence","format","(","https",":","\/\/github.com\/google\/mediapipe\/tree\/master\/mediapipe\/util\/sequence",")",".","Args",":","base_dir",":","The","base","directory","of","the","TFrecords",".","tables",":","A","dictionary","mapping","the","subset","name","(","train",",","val","or","test",")","to","the","relative","path","of","the","SSTable","containing","them",".","Follows","DMVR","convention",".","The","values","of","the","dictionary","can","either","be","a","string","or","a","list",".","If","it","is","a","string",",","it","specifies","all","the","shards","in","the","SSTable",".","Example","-","``","\/path\/to\/tfrecord","@","10","''",".","If","passing","a","list",",","each","entry","is","a","shard","of","the","TFRecord",".","Example","-","``","[","\/path\/to\/sstable_shard_1_of_10",",","...",",","\/path\/to\/sstabble_shard_10_of_10","]",".","''","The","latter","scenario","is","useful","for","debugging",".","subset",":","The","subset","of","the","dataset","to","load",".","Must","be","a","key","of","``","tables","''","modalities",":","Which","modality","to","load",".","Currently","supports","'rgb","'","and","'spectrogram'","prop_data",":","The","proportion","of","the","data","to","load",".","If","less","than","1.0",",","this","proportion","of","the","total","SSTable","shards","are","read",".","num_groups",":","If","specified","will","reshard","the","data","according","to","`","num_groups","`",".","A","`","group_index","`","should","be","specified","if","using","`","num_groups","`",".","group_index",":","Index","of","the","shard","to","return","after","resharding",".","`","num_groups","`","should","be","specified","if","using","`","group_index","`",".","This","is","useful","in","distributed","setting","where","one","wants","to","ensure","that","different","data","is","read","by","different","workers","."]
code: def __init__(
      self,
      base_dir: str,
      tables: Any,
      subset: str = "train",
      modalities: Tuple[str] = ("rgb",),
      prop_data: float = 1.0,
      num_groups: Optional[int] = None,
      group_index: Optional[int] = None,
  ):
      """Initializes the instance of AVSSTableDatasetFactory.
  
      Initializes a data-loader using DeepMind Video Reader (DMVR) pre-processing.
      TFrecords are assumed to consist of tf.SequenceExample protocol buffers in
      the MediaSequence format
      (https://github.com/google/mediapipe/tree/master/mediapipe/util/sequence).
  
      Args:
        base_dir: The base directory of the TFrecords.
        tables: A dictionary mapping the subset name (train, val or test) to the
          relative path of the SSTable containing them. Follows DMVR convention.
          The values of the dictionary can either be a string or a list. If it is
          a string, it specifies all the shards in the SSTable. Example -
          "/path/to/tfrecord@10". If passing a list, each entry is a shard of the
          TFRecord. Example - "[/path/to/sstable_shard_1_of_10, ...,
          /path/to/sstabble_shard_10_of_10]." The latter scenario is useful for
          debugging.
        subset: The subset of the dataset to load. Must be a key of "tables"
        modalities: Which modality to load. Currently supports 'rgb' and
          'spectrogram'
        prop_data: The proportion of the data to load. If less than 1.0, this
          proportion of the total SSTable shards are read.
        num_groups: If specified will reshard the data according to `num_groups`.
          A `group_index` should be specified if using `num_groups`.
        group_index: Index of the shard to return after resharding. `num_groups`
          should be specified if using `group_index`. This is useful in
          distributed setting where one wants to ensure that different data is
          read by different workers.
      """
      if subset not in tables:
          raise ValueError(
              f"Invalid subset {subset}. "
              f"The available subsets are: {set(tables)}"
          )
  
      for modality in modalities:
          if modality not in ASRTFRecordDatasetFactory._MODALITIES:
              raise ValueError("Invalid modality %s." % modality)
      self._modalities = modalities
  
      super().__init__(
          base_dir=base_dir,
          tables=self.construct_tables(tables),
          examples_per_subset=self.construct_examples_per_subset(
              tables
          ),
          subset=subset,
          num_classes=0,
          fraction_data=prop_data,
          num_groups=num_groups,
          group_index=group_index,
      )
  
imports: import functools
  from typing import Any, Dict, Iterator, Optional, Sequence, Text, Tuple
  from absl import logging
  from dmvr import builders
  from dmvr import modalities
  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.dataset_lib import datasets
  from scenic.dataset_lib import video_ops
  from scenic.projects.avatar.datasets.dataset_utils import add_int64
  from scenic.projects.avatar.datasets.dataset_utils import add_spectrogram
  from scenic.projects.avatar.datasets.dataset_utils import add_spectrogram_from_audio
  from scenic.projects.avatar.datasets.dataset_utils import add_text
  from scenic.projects.vivit.data import video_tfrecord_dataset
  import tensorflow
label_desc: Use image node_id 1 to create a new ASRTFRecordDatasetFactory object from inherited base classes: video_tfrecord_dataset with example: obj = ASRTFRecordDatasetFactory(base_dir, tables, subset, modalities, prop_data, num_groups, group_index)