code: def _text_to_ids(self, X, pad_token=None):
      offset = 0
      for X_page in X:
          for chunk in super()._text_to_ids(X_page, pad_token):
              assert len(chunk.token_starts) == len(chunk.token_ends)
              chunk_dict = chunk._asdict()
              chunk_dict["token_starts"] = [
                  start if start == -1 else start + offset
                  for start in chunk_dict["token_starts"]
              ]
              chunk_dict["token_ends"] = [
                  end if end == -1 else end + offset
                  for end in chunk_dict["token_ends"]
              ]
              chunk_dict["offset"] = offset
              yield EncodedOutput(**chunk_dict)
          offset += len(X_page)
  
file_path: finetune/finetune/target_models/document_labeling.py
imports: import warnings
  from finetune.target_models.sequence_labeling import SequenceLabeler, SequencePipeline
  from finetune.encoding.input_encoder import EncodedOutput
  from finetune.errors import FinetuneError
  from finetune.base_models import DocRep, LayoutLM, XDocBase
  from finetune.util.context_utils import get_context_doc_rep
label_desc: Use image node_id 4 for calling the DocumentPipeline obj's underlying member method code with example usage: obj._text_to_ids(X, pad_token) without return types