code: def _load_sample(self, sample, text_only):
      if text_only:
          yield InputSample(
              None,
              self._load_gt_txt(sample["text_path"]),
              SampleMeta(sample["id"], fold_id=sample["fold_id"]),
          )
      else:
          yield InputSample(
              self._load_line(sample["image_path"]),
              self._load_gt_txt(sample["text_path"]),
              SampleMeta(sample["id"], fold_id=sample["fold_id"]),
          )
  
imports: import codecs
  import os
  from copy import deepcopy
  from dataclasses import dataclass, field
  from typing import List
  import numpy
  import logging
  from paiargparse import pai_dataclass, pai_meta
  from tfaip.data.pipeline.definitions import PipelineMode, INPUT_PROCESSOR
  from calamari_ocr.ocr.dataset.datareader.base import CalamariDataGenerator, CalamariDataGeneratorParams, InputSample, SampleMeta
  from calamari_ocr.utils import split_all_ext, glob_all, keep_files_with_same_file_name
label_desc: Use image node_id 2 for calling the FileDataGenerator obj's underlying member method code with example usage: obj._load_sample(sample, text_only) without return types