code: def create_fusion_model_dict(
      config: DictConfig,
      single_models: Optional[Dict] = None,
      pretrained: Optional[bool] = True,
  ):
      """
      Create a dict of single models and fusion piece based on a late-fusion config.
  
      Parameters
      ----------
      config
          The model config.
      single_models
          A dict of single models used in the late-fusion.
  
      Returns
      -------
      single_models
          A dict of single models.
      fusion_model
          The fusion part of a late-fusion model.
      """
      if not single_models:
          single_models = {}
      fusion_model = None
      for model_name in config.names:
          model_config = getattr(config, model_name)
          if not model_name.lower().startswith(FUSION):
              if model_name.endswith(QUERY):
                  model_name = model_name[:-6]  # cut off query
              elif model_name.endswith(RESPONSE):
                  model_name = model_name[:-9]
              else:
                  raise ValueError(
                      f"Model name {model_name} doesn't end with {QUERY} or {RESPONSE}."
                  )
  
              if model_name in single_models:
                  continue
          model = create_model(
              model_name=model_name,
              model_config=model_config,
              pretrained=pretrained,
          )
          if model_name.lower().startswith(FUSION):
              fusion_model = model
          else:
              single_models[model_name] = model
  
      return single_models, fusion_model
  
imports: import copy
  import functools
  import heapq
  import logging
  from typing import Dict, List, Optional, Union
  import pandas
  import torch
  from omegaconf import DictConfig
  from torch import nn
  from torch.nn import functional
  from ..constants import FUSION, QUERY, RESPONSE
  from .data import data_to_df
  from .model import create_model
label_desc: Use image node_id 2 for calling a global function with example usage: create_fusion_model_dict(config, single_models, pretrained) and returns: single_models,  fusion_model