class_docstr: Document Classification with Huggingface backbones. Inherit from HFAutoModelForTextPrediction.
docstr: Load a pretrained huggingface layout-aware document transformer backbone.
  
  Parameters
  ----------
  prefix
      The model prefix.
  checkpoint_name
      Name of the checkpoint. We support loading checkpoint from
      Huggingface Models list: https://huggingface.co/models
      For example, you can use layout-aware models:
          - microsoft/layoutlmv3-base
          - microsoft/layoutlm-base-uncased
          - microsoft/xdoc-base
          - microsoft/layoutxlm-base
          - microsoft/layoutlmv2-base-uncased
      you may also use text focused transformers:
          - 'microsoft/deberta-v3-base'
          - 'bert-base-uncased'
  num_classes
      The number of classes. 1 for a regression task.
  pooling_mode
      The pooling mode for the Transformer. Can be "cls", or "mean"
  gradient_checkpointing
      Whether to enable gradient checkpointing
  low_cpu_mem_usage
      Whether to turn on the optimization of reducing the peak CPU memory usage when loading the pretrained model.
  pretrained
      Whether using the pretrained weights. If pretrained=True, download the pretrained model.
  tokenizer_name
      Name of the huggingface tokenizer type.
docstr_tok: ["Load","a","pretrained","huggingface","layout-aware","document","transformer","backbone",".","Parameters","--","--","--","--","--","prefix","The","model","prefix",".","checkpoint_name","Name","of","the","checkpoint",".","We","support","loading","checkpoint","from","Huggingface","Models","list",":","https",":","\/\/huggingface.co\/models","For","example",",","you","can","use","layout-aware","models",":","-","microsoft\/layoutlmv3-base","-","microsoft\/layoutlm-base-uncased","-","microsoft\/xdoc-base","-","microsoft\/layoutxlm-base","-","microsoft\/layoutlmv2-base-uncased","you","may","also","use","text","focused","transformers",":","-","'microsoft\/deberta-v3-base'","-","'bert-base-uncased'","num_classes","The","number","of","classes",".","1","for","a","regression","task",".","pooling_mode","The","pooling","mode","for","the","Transformer",".","Can","be","``","cls","''",",","or","``","mean","''","gradient_checkpointing","Whether","to","enable","gradient","checkpointing","low_cpu_mem_usage","Whether","to","turn","on","the","optimization","of","reducing","the","peak","CPU","memory","usage","when","loading","the","pretrained","model",".","pretrained","Whether","using","the","pretrained","weights",".","If","pretrained=True",",","download","the","pretrained","model",".","tokenizer_name","Name","of","the","huggingface","tokenizer","type","."]
code: def __init__(
      self,
      prefix: str,
      checkpoint_name: str = "microsoft/layoutlmv3-base",
      num_classes: Optional[int] = 0,
      pooling_mode: Optional[str] = "cls",
      gradient_checkpointing: Optional[bool] = False,
      low_cpu_mem_usage: Optional[bool] = False,
      pretrained: Optional[bool] = True,
      tokenizer_name: Optional[str] = "hf_auto",
  ):
      """
      Load a pretrained huggingface layout-aware document transformer backbone.
  
      Parameters
      ----------
      prefix
          The model prefix.
      checkpoint_name
          Name of the checkpoint. We support loading checkpoint from
          Huggingface Models list: https://huggingface.co/models
          For example, you can use layout-aware models:
              - microsoft/layoutlmv3-base
              - microsoft/layoutlm-base-uncased
              - microsoft/xdoc-base
              - microsoft/layoutxlm-base
              - microsoft/layoutlmv2-base-uncased
          you may also use text focused transformers:
              - 'microsoft/deberta-v3-base'
              - 'bert-base-uncased'
      num_classes
          The number of classes. 1 for a regression task.
      pooling_mode
          The pooling mode for the Transformer. Can be "cls", or "mean"
      gradient_checkpointing
          Whether to enable gradient checkpointing
      low_cpu_mem_usage
          Whether to turn on the optimization of reducing the peak CPU memory usage when loading the pretrained model.
      pretrained
          Whether using the pretrained weights. If pretrained=True, download the pretrained model.
      tokenizer_name
          Name of the huggingface tokenizer type.
      """
      logger.debug(f"initializing {checkpoint_name}")
      super().__init__(
          prefix=prefix,
          checkpoint_name=checkpoint_name,
          num_classes=num_classes,
          pooling_mode=pooling_mode,
          gradient_checkpointing=gradient_checkpointing,
          low_cpu_mem_usage=low_cpu_mem_usage,
          pretrained=pretrained,
          tokenizer_name=tokenizer_name,
      )
      self.is_text_only_flag = self.is_text_only()
  
      if self.is_text_only_flag:
          logger.debug(
              f"Checkpoint: {checkpoint_name} uses the text data only for classification."
          )
  
file_path: autogluon/multimodal/src/autogluon/multimodal/models/document_transformer.py
imports: import inspect
  import logging
  from typing import Callable, Dict, List, Optional, Tuple, Union, cast
  from transformers import logging
  from ..constants import ATTENTION_MASK, AUTOMM, BBOX, COLUMN, COLUMN_FEATURES, FEATURES, IMAGE, INPUT_IDS, LABEL, LOGITS, MASKS, PIXEL_VALUES, TEXT_SEGMENT_IDS, TEXT_TOKEN_IDS, TEXT_VALID_LENGTH, TOKEN_TYPE_IDS
  from .huggingface_text import HFAutoModelForTextPrediction
  from .utils import get_column_features
label_desc: Use image node_id 1 to create a new DocumentTransformer object from inherited base classes: HFAutoModelForTextPrediction with example: obj = DocumentTransformer(prefix, checkpoint_name, num_classes, pooling_mode, gradient_checkpointing, low_cpu_mem_usage, pretrained, tokenizer_name)