class_docstr: A dataset to prepare the instance and class images with the prompts for fine-tuning the model.
  It pre-processes the images and the tokenizes prompts.
  
  :param instance_data_root: required, a directory with images files of the object
  :param instance_prompt: captions with special token associated with instance images
  :param with_prior_preservation: whether to regularize the model finetuning with the original inference output from the backbone
  :param reg_data_root: a directory to save inference images from the backbone
  :param  reg_prompt: prompt used to generate regularization images
  :param size: resizing images for training data pipeline
  :param center_crop: whether performing center cropping on input images
  :param load_cache_latents: when set to True, images will be converted to cached latents which will be directly loaded for training
  :param vae: vae instance to encode imamges from pixel space to latent space
class_docstr_tok: ["A","dataset","to","prepare","the","instance","and","class","images","with","the","prompts","for","fine-tuning","the","model",".","It","pre-processes","the","images","and","the","tokenizes","prompts",".",":","param","instance_data_root",":","required",",","a","directory","with","images","files","of","the","object",":","param","instance_prompt",":","captions","with","special","token","associated","with","instance","images",":","param","with_prior_preservation",":","whether","to","regularize","the","model","finetuning","with","the","original","inference","output","from","the","backbone",":","param","reg_data_root",":","a","directory","to","save","inference","images","from","the","backbone",":","param","reg_prompt",":","prompt","used","to","generate","regularization","images",":","param","size",":","resizing","images","for","training","data","pipeline",":","param","center_crop",":","whether","performing","center","cropping","on","input","images",":","param","load_cache_latents",":","when","set","to","True",",","images","will","be","converted","to","cached","latents","which","will","be","directly","loaded","for","training",":","param","vae",":","vae","instance","to","encode","imamges","from","pixel","space","to","latent","space"]
code: def __getitem__(self, index):
      example = {}
      if self.load_cache_latents:
          example["instance_images"] = torch.load(
              self.instance_images_path[
                  index % self.num_instance_images
              ]
          )
      else:
          example["instance_images"] = self.get_image(
              self.instance_images_path[
                  index % self.num_instance_images
              ]
          )
      example["instance_prompt"] = self.instance_prompt
  
      if self.reg_data_root:
          if self.load_cache_latents:
              example["reg_images"] = torch.load(
                  self.reg_images_path[index % self.num_reg_images]
              )
          else:
              example["reg_images"] = self.get_image(
                  self.reg_images_path[index % self.num_reg_images]
              )
          example["reg_prompt"] = self.reg_prompt
  
      return example
  
file_path: NeMo/nemo/collections/multimodal/data/dreambooth/dreambooth_dataset.py
imports: import os
  from pathlib import Path
  import torch
  from PIL import Image
  from pytorch_lightning.utilities import rank_zero_only
  from torch.utils.data import Dataset
  from tqdm import tqdm
label_desc: Use image node_id 4 for calling the DreamBoothDataset obj's underlying member method code with example usage: obj.__getitem__(index) and returns: example