code: def _run_model_compare(
      task,
      model_list,
      data_config,
      trainer_config,
      optimizer_config,
      train,
      test,
      metric,
      rank_metric,
  ):
      model_list = copy.deepcopy(model_list)
      if isinstance(model_list, list):
          model_list = [
              mdl(task=task, **params) for mdl, params in model_list
          ]
  
      return model_sweep(
          task=task,
          train=train,
          test=test,
          data_config=data_config,
          trainer_config=trainer_config,
          optimizer_config=optimizer_config,
          model_list=model_list,
          metrics=metric[0],
          metrics_params=metric[1],
          metrics_prob_input=metric[2],
          rank_metric=rank_metric,
      )
  
imports: import copy
  import os
  import numpy
  import pytest
  import torch
  from pytorch_tabular import TabularModel, TabularModelTuner, model_sweep
  from pytorch_tabular.config import DataConfig, OptimizerConfig, TrainerConfig
  from pytorch_tabular.config.config import SSLModelConfig
  from pytorch_tabular.feature_extractor import DeepFeatureExtractor
  from pytorch_tabular.models import AutoIntConfig, CategoryEmbeddingModelConfig, FTTransformerConfig, GANDALFConfig, GatedAdditiveTreeEnsembleConfig, NodeConfig, TabNetModelConfig
  from pytorch_tabular.ssl_models import DenoisingAutoEncoderConfig
  from scipy.stats import randint, uniform
  from sklearn.metrics import accuracy_score, r2_score
  from sklearn.model_selection import KFold
label_desc: Use image node_id 21 for calling a global function with example usage: _run_model_compare(task, model_list, data_config, trainer_config, optimizer_config, train, test, metric, rank_metric) and returns: model_sweep