class_docstr: Trainer for BigDL-Nano pytorch.
  
  This Trainer extends PyTorch Lightning Trainer by adding
  various options to accelerate pytorch training.
class_docstr_tok: ["Trainer","for","BigDL-Nano","pytorch",".","This","Trainer","extends","PyTorch","Lightning","Trainer","by","adding","various","options","to","accelerate","pytorch","training","."]
docstr: Run HPO search. It will be called in Trainer.search().
  
  :param model: The model to be searched. It should be an auto model.
  :param resume: whether to resume the previous or start a new one,
      defaults to False.
  :param target_metric: the object metric to optimize,
      defaults to None.
  :param mode: use last epoch's result as trial's score or use best epoch's.
      defaults to 'best', you can change it to 'last'.
  :param n_parallels: the number of parallel processes for running trials.
  :param acceleration: Whether to automatically consider the model after
      inference acceleration in the search process. It will only take
      effect if target_metric contains "latency". Default value is False.
  :param input_sample: A set of inputs for trace, defaults to None if you have
      trace before or model is a LightningModule with any dataloader attached.
  :return: the model with study meta info attached.
docstr_tok: ["Run","HPO","search",".","It","will","be","called","in","Trainer.search","(",")",".",":","param","model",":","The","model","to","be","searched",".","It","should","be","an","auto","model",".",":","param","resume",":","whether","to","resume","the","previous","or","start","a","new","one",",","defaults","to","False",".",":","param","target_metric",":","the","object","metric","to","optimize",",","defaults","to","None",".",":","param","mode",":","use","last","epoch","'s","result","as","trial","'s","score","or","use","best","epoch","'s",".","defaults","to","'best","'",",","you","can","change","it","to","'last","'",".",":","param","n_parallels",":","the","number","of","parallel","processes","for","running","trials",".",":","param","acceleration",":","Whether","to","automatically","consider","the","model","after","inference","acceleration","in","the","search","process",".","It","will","only","take","effect","if","target_metric","contains","``","latency","''",".","Default","value","is","False",".",":","param","input_sample",":","A","set","of","inputs","for","trace",",","defaults","to","None","if","you","have","trace","before","or","model","is","a","LightningModule","with","any","dataloader","attached",".",":","return",":","the","model","with","study","meta","info","attached","."]
code: def search(
      self,
      model,
      resume: bool = False,
      target_metric=None,
      mode: str = "best",
      n_parallels=1,
      acceleration=False,
      input_sample=None,
      **kwargs,
  ):
      """
      Run HPO search. It will be called in Trainer.search().
  
      :param model: The model to be searched. It should be an auto model.
      :param resume: whether to resume the previous or start a new one,
          defaults to False.
      :param target_metric: the object metric to optimize,
          defaults to None.
      :param mode: use last epoch's result as trial's score or use best epoch's.
          defaults to 'best', you can change it to 'last'.
      :param n_parallels: the number of parallel processes for running trials.
      :param acceleration: Whether to automatically consider the model after
          inference acceleration in the search process. It will only take
          effect if target_metric contains "latency". Default value is False.
      :param input_sample: A set of inputs for trace, defaults to None if you have
          trace before or model is a LightningModule with any dataloader attached.
      :return: the model with study meta info attached.
      """
      if not check_hpo_status(self.hposearcher):
          return None
      Trainer._log_api_event("search")
  
      return self.hposearcher.search(
          model,
          resume=resume,
          target_metric=target_metric,
          mode=mode,
          n_parallels=n_parallels,
          acceleration=acceleration,
          input_sample=input_sample,
          **kwargs,
      )
  
imports: import copy
  from logging import warning
  from typing import Any, List, Optional, Union
  import pytorch_lightning
  import torch
  from torch import nn
  from torch.nn.modules.loss import _Loss
  from torch.utils.data import DataLoader
  from torchmetrics.metric import Metric
  from torch.optim.lr_scheduler import _LRScheduler
  from bigdl.nano.pytorch import InferenceOptimizer
  from bigdl.nano.utils.pytorch import TORCH_VERSION_LESS_1_11, check_ccl
  from bigdl.nano.utils.pytorch import ChannelsLastCallback
  from bigdl.nano.utils.pytorch import save_model, load_model
  from bigdl.nano.pytorch.algorithms import SelectiveBackprop
  from bigdl.nano.pytorch.lightning import LightningModule
  from bigdl.nano.pytorch.strategies import IPEXStrategy, DDPSpawnStrategy, DDPSubprocessStrategy, DDPK8sStrategy
  from bigdl.nano.deps.automl.hpo_api import create_hpo_searcher, check_hpo_status
  from bigdl.nano.deps.ray.ray_api import create_ray_strategy
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.common import _avx512_checker
  from bigdl.nano.utils.common import deprecated
label_desc: Use image node_id 4 for calling the Trainer obj's underlying member method code with example usage: obj.search(model, resume, target_metric, mode, n_parallels, acceleration, input_sample) and returns: self, None