docstr_tok: []
code: def __init__(
      self,
      data_dict: Dict,
      batch_size: int = 16,
      max_length: int = 128,
      shuffle: bool = False,
  ):
      """ """
  
      self.batch_size = batch_size
      self.shuffle = shuffle
  
      self.batch_size = batch_size
  
      self.data_dict = data_dict
      self.dataset_len = data_dict["len"]
      self.len = (
          self.dataset_len
          if max_length is None
          else min(self.dataset_len, max_length)
      )
      # Calculate # batches
      num_batches, remainder = divmod(self.len, self.batch_size)
      if remainder > 0:
          num_batches += 1
      self.num_batches = num_batches
  
imports: from typing import Callable, Dict
  import torch
  from torch.utils.data import Dataset
  import torchvision.transforms.functional
  from torchvision import transforms
  import pytorch_lightning
  from collections.abc import Iterable
  from pathlib import Path
  from PIL import Image
  from typing import Tuple
label_desc: Use image node_id 1 to create a new DataDictLoader object  with example: obj = DataDictLoader(data_dict, batch_size, max_length, shuffle)