docstr: Download annotation files if necessary.
  All the vision-language datasets should have annotations of unified format.
  
  storage_path can be:
    (1) relative/absolute: will be prefixed with env.cache_root to make full path if relative.
    (2) basename/dirname: will be suffixed with base name of URL if dirname is provided.
  
  Local annotation paths should be relative.
docstr_tok: ["Download","annotation","files","if","necessary",".","All","the","vision-language","datasets","should","have","annotations","of","unified","format",".","storage_path","can","be",":","(","1",")","relative\/absolute",":","will","be","prefixed","with","env.cache_root","to","make","full","path","if","relative",".","(","2",")","basename\/dirname",":","will","be","suffixed","with","base","name","of","URL","if","dirname","is","provided",".","Local","annotation","paths","should","be","relative","."]
code: def _download_ann(self):
      """
      Download annotation files if necessary.
      All the vision-language datasets should have annotations of unified format.
  
      storage_path can be:
        (1) relative/absolute: will be prefixed with env.cache_root to make full path if relative.
        (2) basename/dirname: will be suffixed with base name of URL if dirname is provided.
  
      Local annotation paths should be relative.
      """
      anns = self.config.build_info.annotations
  
      splits = anns.keys()
  
      cache_root = registry.get_path("cache_root")
  
      for split in splits:
          info = anns[split]
  
          urls, storage_paths = info.get("url", None), info.storage
  
          if isinstance(urls, str):
              urls = [urls]
          if isinstance(storage_paths, str):
              storage_paths = [storage_paths]
  
          assert len(urls) == len(storage_paths)
  
          for url_or_filename, storage_path in zip(urls, storage_paths):
              # if storage_path is relative, make it full by prefixing with cache_root.
              if not os.path.isabs(storage_path):
                  storage_path = os.path.join(cache_root, storage_path)
  
              dirname = os.path.dirname(storage_path)
              if not os.path.exists(dirname):
                  os.makedirs(dirname)
  
              if os.path.isfile(url_or_filename):
                  src, dst = url_or_filename, storage_path
                  if not os.path.exists(dst):
                      shutil.copyfile(src=src, dst=dst)
                  else:
                      logging.info(
                          "Using existing file {}.".format(dst)
                      )
              else:
                  if os.path.isdir(storage_path):
                      # if only dirname is provided, suffix with basename of URL.
                      raise ValueError(
                          "Expecting storage_path to be a file path, got directory {}".format(
                              storage_path
                          )
                      )
                  else:
                      filename = os.path.basename(storage_path)
  
                  download_url(
                      url=url_or_filename,
                      root=dirname,
                      filename=filename,
                  )
  
imports: import logging
  import os
  import shutil
  import warnings
  import lavis.common.utils
  import torch.distributed
  from lavis.common.dist_utils import is_dist_avail_and_initialized, is_main_process
  from lavis.common.registry import registry
  from lavis.datasets.data_utils import extract_archive
  from lavis.processors.base_processor import BaseProcessor
  from omegaconf import OmegaConf
  from torchvision.datasets.utils import download_url
label_desc: Use image node_id 7 for calling the BaseDatasetBuilder obj's underlying member method code with example usage: obj._download_ann() without return types