code: def __init__(self, data_path, read_encoded, source_mode, **kwargs):
      super().__init__(**kwargs)
      if source_mode == "generator":
          self.loader, self.data_set_len = create_dataset_generator(
              data_path,
              batch_size=kwargs["batch_size"],
              read_encoded=read_encoded,
          )
      else:
          self.data_set_len = None
          if read_encoded:
              loader_sample, loader_batch = SampleLoader, BatchLoader
          else:
              loader_sample, loader_batch = (
                  CV2SampleLoader,
                  CV2BatchLoader,
              )
          if source_mode == "batch":
              self.loader = loader_batch(
                  data_path, batch_size=kwargs["batch_size"]
              )
          else:
              self.loader = loader_sample(data_path)
  
imports: import argparse
  import cv2
  import numpy
  import nvidia.dali
  import nvidia.dali.types
  import os
label_desc: Use image node_id 1 to create a new ExternalSourcePipeline object from inherited base classes: dali.pipeline with example: obj = ExternalSourcePipeline(data_path, read_encoded, source_mode)