class_docstr: ImgTextTarDataset class for datasets that store Image-Text pairs as tar files, each tar file with multiple pairs.
  
  The dataset should be stored in following format where `img_text_tar_dataset` is the location of directory that
  has all tar files.
  
  img_text_tar_dataset
  |--- 00000000_0_1000.tar.gz
  |-------- 00000000_0_image
  |-------- 00000000_0_text
  |-------- 00000000_1_image
  |-------- 00000000_1_text
  |-------- ...
  
  |--- 00000000_1000_2000.tar.gz
  |-------- 00000000_1000_image
  |-------- 00000000_1000_text
  |-------- 00000000_1001_image
  |-------- 00000000_1001_text
  |-------- ...
  
  Args:
      opts: An argparse.Namespace instance.
class_docstr_tok: ["ImgTextTarDataset","class","for","datasets","that","store","Image-Text","pairs","as","tar","files",",","each","tar","file","with","multiple","pairs",".","The","dataset","should","be","stored","in","following","format","where","`","img_text_tar_dataset","`","is","the","location","of","directory","that","has","all","tar","files",".","img_text_tar_dataset","|","--","-","00000000_0_1000.tar.gz","|","--","--","--","--","00000000_0_image","|","--","--","--","--","00000000_0_text","|","--","--","--","--","00000000_1_image","|","--","--","--","--","00000000_1_text","|","--","--","--","--","...","|","--","-","00000000_1000_2000.tar.gz","|","--","--","--","--","00000000_1000_image","|","--","--","--","--","00000000_1000_text","|","--","--","--","--","00000000_1001_image","|","--","--","--","--","00000000_1001_text","|","--","--","--","--","...","Args",":","opts",":","An","argparse.Namespace","instance","."]
code: def __init__(
      self,
      opts,
      *args,
      **kwargs,
  ) -> None:
      super().__init__(
          opts=opts,
          *args,
          **kwargs,
      )
      self.zeros_shot_dataset = self.get_zero_shot_dataset()
  
      if self.is_training:
          dataset_metadata = self.get_dataset()
  
          total_files = 0
          if -1 in dataset_metadata.keys():
              # At key=-1, we store the information about total files.
              total_files = dataset_metadata.pop(-1)
  
          if total_files == 0:
              logger.error(
                  "Total files can't be 0. Please check if metadata has key -1, which stores "
                  "the total number of files"
              )
  
          self.dataset: Dict = dataset_metadata
          self.total_pairs = total_files
          self.dataset_keys = list(self.dataset.keys())
  
          s3_bucket_path = getattr(
              self.opts,
              "dataset.multi_modal_img_text.img_text_tar.s3_bucket_path",
          )
          if s3_bucket_path is None:
              if self.is_master_node:
                  logger.log(
                      "{} needs the path of AWS bucket where data is stored.".format(
                          self.__class__.__name__
                      )
                  )
  
          self.s3_bucket_path = s3_bucket_path
  
          self._download_dataset()
  
imports: import argparse
  import glob
  import io
  import os
  import pickle
  import tarfile
  from multiprocessing.pool import Pool
  from typing import AnyStr, Dict, Tuple
  import numpy
  import torch
  from PIL import Image, ImageFile
  from data.datasets import DATASET_REGISTRY
  from data.datasets.multi_modal_img_text.base_multi_modal_img_text import BaseMultiModalImgText
  from utils import logger, resources
  from utils.ddp_utils import dist_barrier
  from utils.download_utils import get_local_path
label_desc: Use image node_id 1 to create a new ImgTextTarDataset object from inherited base classes: BaseMultiModalImgText with example: obj = ImgTextTarDataset(opts)