code: def modify_duplicate_model_names(
      learner,
      postfix: str,
      blacklist: List[str],
  ):
      """
      Modify a learner's model names if they exist in a blacklist.
  
      Parameters
      ----------
      learner
          A BaseLearner object.
      postfix
          The postfix used to change the duplicate names.
      blacklist
          A list of names. The provided learner can't use model names in the list.
  
      Returns
      -------
      The learner guaranteed has no duplicate model names with the blacklist names.
      """
      model_names = []
      for n in learner._config.model.names:
          if n in blacklist:
              new_name = f"{n}_{postfix}"
              assert new_name not in blacklist
              assert new_name not in learner._config.model.names
              # modify model prefix
              if n == learner._model.prefix:
                  learner._model.prefix = new_name
              else:
                  assert isinstance(learner._model.model, nn.ModuleList)
                  for per_model in learner._model.model:
                      if n == per_model.prefix:
                          per_model.prefix = new_name
                          break
              # modify data processor prefix
              for (
                  per_modality_processors
              ) in learner._data_processors.values():
                  for per_processor in per_modality_processors:
                      if n == per_processor.prefix:
                          per_processor.prefix = new_name
              # modify model config keys
              setattr(
                  learner._config.model,
                  new_name,
                  getattr(learner._config.model, n),
              )
              delattr(learner._config.model, n)
  
              model_names.append(new_name)
          else:
              model_names.append(n)
  
      learner._config.model.names = model_names
  
      return learner
  
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 5 for calling a global function with example usage: modify_duplicate_model_names(learner, postfix, blacklist) and returns: learner