docstr: Build a Generic Model using config parameters.
docstr_tok: ["Build","a","Generic","Model","using","config","parameters","."]
code: def _build_automodel(
      self, data, validation_data=None, batch_size=32, epochs=1
  ):
      """Build a Generic Model using config parameters."""
      merged_config = {
          **self.model_config,
          **self.optim_config,
          **self.loss_config,
          **self.data_config,
      }
  
      model_config_keys = list(self.model_config.keys())
      data_config_keys = list(self.data_config.keys())
      optim_config_keys = list(self.optim_config.keys())
      loss_config_keys = list(self.loss_config.keys())
  
      return GenericTSTransformerLightningModule(
          model_creator=self.model_creator,
          loss_creator=self.loss_creator,
          data=data,
          validation_data=validation_data,
          batch_size=batch_size,
          epochs=epochs,
          metrics=[_str2metric(metric) for metric in self.metrics],
          scheduler=None,  # TODO
          num_processes=self.num_processes,
          model_config_keys=model_config_keys,
          data_config_keys=data_config_keys,
          optim_config_keys=optim_config_keys,
          loss_config_keys=loss_config_keys,
          **merged_config,
      )
  
imports: import torch
  import numpy
  from pandas import Timedelta
  from bigdl.chronos.forecaster.abstract import Forecaster
  from bigdl.chronos.forecaster.utils import read_csv, delete_folder
  from bigdl.chronos.metric.forecast_metrics import Evaluator
  from bigdl.chronos.model.autoformer import model_creator, loss_creator
  from torch.utils.data import TensorDataset, DataLoader
  from bigdl.chronos.model.autoformer.Autoformer import AutoFormer, _transform_config_to_namedtuple
  from bigdl.nano.utils.common import invalidInputError, invalidOperationError
  from bigdl.chronos.forecaster.utils import check_transformer_data
  from bigdl.chronos.pytorch import TSTrainer
  from bigdl.chronos.data import TSDataset
  from bigdl.nano.automl.hpo.space import Space
  from bigdl.chronos.forecaster.utils_hpo import GenericTSTransformerLightningModule, _config_has_search_space
  from bigdl.chronos.pytorch.context_manager import DummyForecasterContextManager, ForecasterContextManager
  from .utils_hpo import _format_metric_str
  import warnings
  from tempfile import TemporaryDirectory
  import os
label_desc: Use image node_id 2 for calling the AutoformerForecaster obj's underlying member method code with example usage: obj._build_automodel(data, validation_data, batch_size, epochs) and returns: GenericTSTransformerLightningModule