code: def create_fusion_model(
      config: DictConfig,
      num_classes: Optional[int] = None,
      classes: Optional[list] = None,
      num_numerical_columns: Optional[int] = None,
      num_categories: Optional[List[int]] = None,
      pretrained: Optional[bool] = True,
  ):
      """
      Create models. It supports the auto models of huggingface text and timm image.
      Multimodal models, e.g., CLIP, should be added case-by-case since their configs and usages
      may be different. It uses MLP for the numerical features, categorical features, and late-fusion.
  
      Parameters
      ----------
      config
          A DictConfig object. The model config should be accessible by "config.model".
      num_classes
          The class number for a classification task. It should be 1 for a regression task.
      classes
          All classes in this dataset.
      num_numerical_columns
          The number of numerical columns in the training dataframe.
      num_categories
          The category number for each categorical column in the training dataframe.
      pretrained
          Whether using the pretrained timm models. If pretrained=True, download the pretrained model.
  
      Returns
      -------
      A Pytorch model.
      """
      names = config.model.names
      if isinstance(names, str):
          names = [names]
      # make sure no duplicate model names
      assert len(names) == len(set(names))
      logger.debug(f"output_shape: {num_classes}")
      names = sorted(names)
      config.model.names = names
      single_models = []
      fusion_model = None
  
      for model_name in names:
          model_config = getattr(config.model, model_name)
          model = create_model(
              model_name=model_name,
              model_config=model_config,
              num_classes=num_classes,
              classes=classes,
              num_numerical_columns=num_numerical_columns,
              num_categories=num_categories,
              pretrained=pretrained,
          )
  
          if isinstance(model, functools.partial):  # fusion model
              if fusion_model is None:
                  fusion_model = model
              else:
                  raise ValueError(
                      f"More than one fusion models are detected in {names}. Only one fusion model is allowed."
                  )
          else:  # single model
              if (
                  OmegaConf.select(
                      config, "optimization.efficient_finetune"
                  )
                  is not None
                  and OmegaConf.select(
                      config, "optimization.efficient_finetune"
                  )
                  != "None"
              ):
                  model = apply_model_adaptation(model, config)
              single_models.append(model)
  
      if len(single_models) > 1:
          # must have one fusion model if there are multiple independent models
          return fusion_model(models=single_models)
      elif len(single_models) == 1:
          return single_models[0]
      else:
          raise ValueError(f"No available models for {names}")
  
file_path: autogluon/multimodal/src/autogluon/multimodal/utils/model.py
imports: import functools
  import json
  import logging
  import warnings
  from typing import Dict, List, Optional, Tuple, Union
  import timm
  from omegaconf import DictConfig, OmegaConf
  from torch import Tensor, nn
  from ..constants import ALL_MODALITIES, AUTOMM, CATEGORICAL, CATEGORICAL_MLP, CLIP, DOCUMENT, DOCUMENT_TRANSFORMER, FT_TRANSFORMER, FUSION_MLP, FUSION_NER, FUSION_TRANSFORMER, HF_TEXT, IMAGE, MMDET_IMAGE, MMOCR_TEXT_DET, MMOCR_TEXT_RECOG, NER, NER_TEXT, NUMERICAL, NUMERICAL_MLP, OVD, PEFT_ADDITIVE_STRATEGIES, SAM, SEMANTIC_SEGMENTATION_IMG, T_FEW, TEXT, TEXT_NER, TIMM_IMAGE, XYXY
  from ..data import MultiModalFeaturePreprocessor
  from ..models import CategoricalMLP, CLIPForImageText, DocumentTransformer, FT_Transformer, HFAutoModelForNER, HFAutoModelForTextPrediction, MMDetAutoModelForObjectDetection, MMOCRAutoModelForTextDetection, MMOCRAutoModelForTextRecognition, MultimodalFusionMLP, MultimodalFusionNER, MultimodalFusionTransformer, NumericalMLP, OVDModel, SAMForSemanticSegmentation, TFewModel, TimmAutoModelForImagePrediction
  from ..models.utils import inject_adaptation_to_linear_layer
label_desc: Use image node_id 3 for calling a global function with example usage: create_fusion_model(config, num_classes, classes, num_numerical_columns, num_categories, pretrained) and returns: fusion_model, single_models