code: def build_dataset(cfg, default_args=None):
      """Build datasets."""
      from .dataset_wrappers import ConcatDataset, RepeatDataset
  
      if isinstance(cfg, (list, tuple)):
          dataset = ConcatDataset(
              [build_dataset(c, default_args) for c in cfg]
          )
      elif cfg["type"] == "RepeatDataset":
          dataset = RepeatDataset(
              build_dataset(cfg["dataset"], default_args), cfg["times"]
          )
      elif isinstance(cfg.get("img_dir"), (list, tuple)) or isinstance(
          cfg.get("split", None), (list, tuple)
      ):
          dataset = _concat_dataset(cfg, default_args)
      else:
          dataset = build_from_cfg(cfg, DATASETS, default_args)
  
      return dataset
  
file_path: lavis/lavis/common/annotator/uniformer/mmseg/datasets/builder.py
imports: import copy
  import platform
  import random
  from functools import partial
  import numpy
  from annotator.uniformer.mmcv.parallel import collate
  from annotator.uniformer.mmcv.runner import get_dist_info
  from annotator.uniformer.mmcv.utils import Registry, build_from_cfg
  from annotator.uniformer.mmcv.utils.parrots_wrapper import DataLoader, PoolDataLoader
  from torch.utils.data import DistributedSampler
label_desc: Use image node_id 2 for calling a global function with example usage: build_dataset(cfg, default_args) and returns: dataset