class_docstr: The Tuning objective for HPO.
code: def _pre_train(self, model, trial):
      # only do shallow copy and process/duplicate
      # specific args TODO: may need to handle more cases
      if self.pruning:
          callbacks = self.searcher.trainer.callbacks or []
          pruning_cb = create_pl_pruning_callback(
              trial, monitor=self.target_metric
          )
          callbacks.append(pruning_cb)
          self.searcher.trainer.callbacks = callbacks
  
      # links data to the trainer
      self.searcher.trainer._data_connector.attach_data(  # type: ignore
          model,
          train_dataloaders=self.train_dataloaders,
          val_dataloaders=self.val_dataloaders,
          datamodule=self.datamodule,
      )
  
      if self.mode == "best":
          callbacks = self.searcher.trainer.callbacks or []
          callbacks.append(
              BestMetricCallback(self.metric, direction=self.direction)
          )
          self.searcher.trainer.callbacks = callbacks
  
imports: from collections import namedtuple
  from typing import Optional, Union
  import pytorch_lightning
  from pytorch_lightning.utilities.types import EVAL_DATALOADERS, TRAIN_DATALOADERS
  from pytorch_lightning.utilities import rank_zero_deprecation
  from pytorch_lightning.core.datamodule import LightningDataModule
  from bigdl.nano.pytorch import InferenceOptimizer
  from bigdl.nano.automl.hpo.backend import create_pl_pruning_callback
  from bigdl.nano.utils.common import invalidInputError
  from ._helper import LatencyCallback, _remove_metric_prefix, BestMetricCallback
  import inspect
  import copy
label_desc: Use image node_id 3 for calling the Objective obj's underlying member method code with example usage: obj._pre_train(model, trial) without return types