code: def create_data_processor(
      data_type: str,
      config: DictConfig,
      model: nn.Module,
      advanced_hyperparameters: Optional[Dict] = None,
  ):
      """
      Create one data processor based on the data type and model.
  
      Parameters
      ----------
      data_type
          Data type.
      config
          The config may contain information required by creating a data processor.
          In future, we may move the required config information into the model.config
          to make the data processor conditioned only on the model itself.
      model
          The model.
  
      Returns
      -------
      One data processor.
      """
      model_config = getattr(config.model, model.prefix)
      if data_type == IMAGE:
          train_transforms, val_transforms = get_image_transforms(
              model_config=model_config,
              model_name=model.prefix,
              advanced_hyperparameters=advanced_hyperparameters,
          )
  
          data_processor = ImageProcessor(
              model=model,
              train_transforms=train_transforms,
              val_transforms=val_transforms,
              norm_type=model_config.image_norm,
              size=model_config.image_size,
              max_img_num_per_col=model_config.max_img_num_per_col,
              missing_value_strategy=config.data.image.missing_value_strategy,
          )
      elif data_type == TEXT:
          data_processor = TextProcessor(
              model=model,
              max_len=model_config.max_text_len,
              insert_sep=model_config.insert_sep,
              text_segment_num=model_config.text_segment_num,
              stochastic_chunk=model_config.stochastic_chunk,
              text_detection_length=OmegaConf.select(
                  model_config, "text_aug_detect_length"
              ),
              text_trivial_aug_maxscale=OmegaConf.select(
                  model_config, "text_trivial_aug_maxscale"
              ),
              train_augment_types=OmegaConf.select(
                  model_config, "text_train_augment_types"
              ),
              template_config=getattr(
                  config.data,
                  "templates",
                  OmegaConf.create({"turn_on": False}),
              ),
              normalize_text=getattr(
                  config.data.text, "normalize_text", False
              ),
          )
      elif data_type == CATEGORICAL:
          data_processor = CategoricalProcessor(
              model=model,
          )
      elif data_type == NUMERICAL:
          data_processor = NumericalProcessor(
              model=model,
              merge=model_config.merge,
          )
      elif data_type == LABEL:
          data_processor = LabelProcessor(model=model)
      elif data_type == TEXT_NER:
          data_processor = NerProcessor(
              model=model,
              max_len=model_config.max_text_len,
              entity_map=config.entity_map,
          )
      elif data_type == ROIS:
          data_processor = MMDetProcessor(
              model=model,
              max_img_num_per_col=model_config.max_img_num_per_col,
              missing_value_strategy=config.data.image.missing_value_strategy,
          )
      elif data_type == OVD:
          data_processor = OVDProcessor(
              model=model,
              max_img_num_per_col=model_config.max_img_num_per_col,
              missing_value_strategy=config.data.image.missing_value_strategy,
          )
      elif data_type == DOCUMENT:
          train_transforms, val_transforms = get_image_transforms(
              model_config=model_config,
              model_name=model.prefix,
              advanced_hyperparameters=advanced_hyperparameters,
          )
          data_processor = DocumentProcessor(
              model=model,
              train_transform_types=train_transforms,
              val_transform_types=val_transforms,
              norm_type=model_config.image_norm,
              size=model_config.image_size,
              text_max_len=model_config.max_text_len,
              missing_value_strategy=config.data.document.missing_value_strategy,
          )
      elif data_type == SEMANTIC_SEGMENTATION_IMG:
          data_processor = SemanticSegImageProcessor(
              model=model,
              img_transforms=model_config.img_transforms,
              gt_transforms=model_config.gt_transforms,
              train_transforms=model_config.train_transforms,
              val_transforms=model_config.val_transforms,
              norm_type=model_config.image_norm,
              ignore_label=model_config.ignore_label,
          )
      else:
          raise ValueError(f"unknown data type: {data_type}")
  
      return data_processor
  
imports: import copy
  import logging
  import os
  import warnings
  from typing import Dict, List, Optional, Tuple, Union
  import pandas
  from omegaconf import DictConfig, OmegaConf
  from torch import nn
  from autogluon.core.utils import default_holdout_frac, generate_train_test_split_combined
  from autogluon.core.utils.loaders import load_pd
  from ..constants import BINARY, CATEGORICAL, DEFAULT_SHOT, DOCUMENT, FEW_SHOT, IMAGE, IMAGE_PATH, LABEL, MMLAB_MODELS, MULTICLASS, NER, NER_ANNOTATION, NER_TEXT, NUMERICAL, OVD, REGRESSION, ROIS, SAM, SEMANTIC_SEGMENTATION_IMG, TEXT, TEXT_NER
  from ..data import CategoricalProcessor, DocumentProcessor, ImageProcessor, LabelProcessor, MixupModule, MMDetProcessor, MMOcrProcessor, MultiModalFeaturePreprocessor, NerLabelEncoder, NerProcessor, NumericalProcessor, OVDProcessor, SemanticSegImageProcessor, TextProcessor
  from ..data.infer_types import is_image_column
label_desc: Use image node_id 2 for calling a global function with example usage: create_data_processor(data_type, config, model, advanced_hyperparameters) and returns: data_processor