code: def get_preset_models(
      freq: str,
      prediction_length: int,
      path: str,
      eval_metric: TimeSeriesScorer,
      eval_metric_seasonal_period: Optional[int],
      hyperparameters: Union[str, Dict, None],
      hyperparameter_tune: bool,
      all_assigned_names: List[str],
      excluded_model_types: List[str],
      multi_window: bool = False,
      **kwargs,
  ):
      """
      Create a list of models according to hyperparameters. If hyperparamaters=None,
      will create models according to presets.
      """
      models = []
      if hyperparameters is None:
          hp_string = "default"
          hyperparameters = copy.deepcopy(get_default_hps(hp_string))
      elif isinstance(hyperparameters, str):
          hyperparameters = copy.deepcopy(
              get_default_hps(hyperparameters)
          )
      elif isinstance(hyperparameters, dict):
          hyperparameters = copy.deepcopy(hyperparameters)
      else:
          raise ValueError(
              f"hyperparameters must be a dict, a string or None (received {type(hyperparameters)}). "
              f"Please see the documentation for TimeSeriesPredictor.fit"
          )
      hyperparameters = check_and_clean_hyperparameters(
          hyperparameters, must_contain_searchspace=hyperparameter_tune
      )
  
      excluded_models = set()
      if (
          excluded_model_types is not None
          and len(excluded_model_types) > 0
      ):
          if not isinstance(excluded_model_types, list):
              raise ValueError(
                  f"`excluded_model_types` must be a list, received {type(excluded_model_types)}"
              )
          logger.info(f"Excluded model types: {excluded_model_types}")
          for model in excluded_model_types:
              if not isinstance(model, str):
                  raise ValueError(
                      f"Each entry in `excluded_model_types` must be a string, received {type(model)}"
                  )
              excluded_models.add(normalize_model_type_name(model))
  
      all_assigned_names = set(all_assigned_names)
  
      model_priority_list = sorted(
          hyperparameters.keys(),
          key=lambda x: DEFAULT_MODEL_PRIORITY.get(x, 0),
          reverse=True,
      )
  
      for model in model_priority_list:
          if isinstance(model, str):
              if model not in MODEL_TYPES:
                  raise ValueError(
                      f"Model {model} is not supported yet."
                  )
              if model in excluded_models:
                  logger.info(
                      f"\tFound '{model}' model in `hyperparameters`, but '{model}' "
                      "is present in `excluded_model_types` and will be removed."
                  )
                  continue
              if "mxnet" in model.lower():
                  logger.info(
                      f"\tMXNet model '{model}' given in `hyperparameters` is deprecated and won't be trained. "
                  )
                  continue
              model_type = MODEL_TYPES[model]
          elif isinstance(model, type):
              if not issubclass(model, AbstractTimeSeriesModel):
                  raise ValueError(
                      f"Custom model type {model} must inherit from `AbstractTimeSeriesModel`."
                  )
              model_type = model
          else:
              raise ValueError(
                  f"Keys of the `hyperparameters` dictionary must be strings or types, received {type(model)}."
              )
  
          for model_hps in hyperparameters[model]:
              ag_args = model_hps.pop(constants.AG_ARGS, {})
              for key in ag_args:
                  if key not in VALID_AG_ARGS_KEYS:
                      raise ValueError(
                          f"Model {model_type} received unknown ag_args key: {key} (valid keys {VALID_AG_ARGS_KEYS})"
                      )
              model_name_base = get_model_name(ag_args, model_type)
  
              model_type_kwargs = dict(
                  name=model_name_base,
                  path=path,
                  freq=freq,
                  prediction_length=prediction_length,
                  eval_metric=eval_metric,
                  eval_metric_seasonal_period=eval_metric_seasonal_period,
                  hyperparameters=model_hps,
                  **kwargs,
              )
  
              # add models while preventing name collisions
              model = model_type(**model_type_kwargs)
  
              model_type_kwargs.pop("name", None)
              increment = 1
              while model.name in all_assigned_names:
                  increment += 1
                  model = model_type(
                      name=f"{model_name_base}_{increment}",
                      **model_type_kwargs,
                  )
  
              if multi_window:
                  model = MultiWindowBacktestingModel(
                      model_base=model,
                      name=model.name,
                      **model_type_kwargs,
                  )
  
              all_assigned_names.add(model.name)
              models.append(model)
  
      return models
  
file_path: autogluon/timeseries/src/autogluon/timeseries/models/presets.py
imports: import copy
  import logging
  import re
  from collections import defaultdict
  from typing import Any, Dict, List, Optional, Type, Union
  from autogluon.common import space
  from autogluon.core import constants
  from autogluon.timeseries.metrics import TimeSeriesScorer
  from .None import ADIDAModel, AutoARIMAModel, AutoCESModel, AutoETSModel, AverageModel, CrostonSBAModel, DeepARModel, DirectTabularModel, DLinearModel, DynamicOptimizedThetaModel, ETSModel, IMAPAModel, NaiveModel, NPTSModel, PatchTSTModel, RecursiveTabularModel, SeasonalAverageModel, SeasonalNaiveModel, SimpleFeedForwardModel, TemporalFusionTransformerModel, ThetaModel, WaveNetModel, ZeroModel
  from .abstract import AbstractTimeSeriesModel
  from .multi_window.multi_window_model import MultiWindowBacktestingModel
label_desc: Use image node_id 2 for calling a global function with example usage: get_preset_models(freq, prediction_length, path, eval_metric, eval_metric_seasonal_period, hyperparameters, hyperparameter_tune, all_assigned_names, excluded_model_types, multi_window) and returns: models