code: def create_data_generator(self) -> DataGenerator:
      reader = self.reader()
  
      class Gen(DataGenerator):
          def __len__(self):
              return len(reader)
  
          def generate(self) -> Iterable[Sample]:
              # Depending on the mode, do not produce images or targets (force it for the future pipeline)
              if self.mode == PipelineMode.PREDICTION:
                  return map(
                      lambda s: Sample(inputs=s.inputs, meta=s.meta),
                      reader.generate(),
                  )
              elif self.mode == PipelineMode.TARGETS:
                  return map(
                      lambda s: Sample(targets=s.targets, meta=s.meta),
                      reader.generate(),
                  )
  
              return reader.generate()
  
      return Gen(self.mode, self.generator_params)
  
file_path: calamari/calamari_ocr/ocr/dataset/pipeline.py
imports: from typing import Iterable
  from tfaip.data.pipeline.datapipeline import DataPipeline, DataGenerator
  from tfaip.data.pipeline.definitions import Sample, PipelineMode
  from calamari_ocr.ocr.dataset.datareader.base import CalamariDataGeneratorParams
label_desc: Use image node_id 3 for calling the CalamariPipeline obj's underlying member method code with example usage: obj.create_data_generator() and returns: Gen, len, reader, map, map