docstr: dataset_dict: dictionary mapping from index to batch
  length is used in the case of DistributedSampler: e.g. the dataset could have size 1k, but
  with 8 GPUs the dataset_dict would only have 125 items.
docstr_tok: ["dataset_dict",":","dictionary","mapping","from","index","to","batch","length","is","used","in","the","case","of","DistributedSampler",":","e.g",".","the","dataset","could","have","size","1k",",","but","with","8","GPUs","the","dataset_dict","would","only","have","125","items","."]
code: def __init__(self, dataset_dict, length=None):
      """dataset_dict: dictionary mapping from index to batch
      length is used in the case of DistributedSampler: e.g. the dataset could have size 1k, but
      with 8 GPUs the dataset_dict would only have 125 items.
      """
      super().__init__()
      self.dataset_dict = dataset_dict
      self.length = length or len(self.dataset_dict)
  
imports: import os
  from pathlib import Path
  from typing import Any, List, Union, Callable, Optional
  import torch
  from torch.utils.data import Dataset, DataLoader, SequentialSampler
  from torch.utils.data.dataloader import default_collate
  from torch.utils.data.distributed import DistributedSampler
  from pytorch_lightning import LightningDataModule
  from torchvision import transforms
  from torchvision.datasets import ImageFolder
label_desc: Use image node_id 1 to create a new DictDataset object from inherited base classes: Dataset with example: obj = DictDataset(dataset_dict, length)