class_docstr: Neural Network related operators that involve machine learning frameworks.
  
  Args:
      framework (`str`):
          The framework to apply.
class_docstr_tok: ["Neural","Network","related","operators","that","involve","machine","learning","frameworks",".","Args",":","framework","(","`","str","`",")",":","The","framework","to","apply","."]
docstr: Set up the trainer instance in operator before training and set trainer parameters.
  Args:
      training_config (`TrainingConfig`):
          The config of this trainer.
      train_dataset (`Union[Dataset, TowheeDataSet]`):
          Training dataset.
      eval_dataset (`Union[Dataset, TowheeDataSet]`):
          Evaluate dataset.
      train_dataloader (`Union[DataLoader, Iterable]`):
          If specified, `Trainer` will use it to load training data.
          Otherwise, `Trainer` will build dataloader from train_dataset.
      eval_dataloader (`Union[DataLoader, Iterable]`):
          If specified, `Trainer` will use it to load evaluate data.
          Otherwise, `Trainer` will build dataloader from train_dataset.
      model_card (`ModelCard`):
          Model card contains the training informations.
  Returns:
docstr_tok: ["Set","up","the","trainer","instance","in","operator","before","training","and","set","trainer","parameters",".","Args",":","training_config","(","`","TrainingConfig","`",")",":","The","config","of","this","trainer",".","train_dataset","(","`","Union","[","Dataset",",","TowheeDataSet","]","`",")",":","Training","dataset",".","eval_dataset","(","`","Union","[","Dataset",",","TowheeDataSet","]","`",")",":","Evaluate","dataset",".","train_dataloader","(","`","Union","[","DataLoader",",","Iterable","]","`",")",":","If","specified",",","`","Trainer","`","will","use","it","to","load","training","data",".","Otherwise",",","`","Trainer","`","will","build","dataloader","from","train_dataset",".","eval_dataloader","(","`","Union","[","DataLoader",",","Iterable","]","`",")",":","If","specified",",","`","Trainer","`","will","use","it","to","load","evaluate","data",".","Otherwise",",","`","Trainer","`","will","build","dataloader","from","train_dataset",".","model_card","(","`","ModelCard","`",")",":","Model","card","contains","the","training","informations",".","Returns",":"]
code: def setup_trainer(
      self,
      training_config=None,
      train_dataset=None,
      eval_dataset=None,
      train_dataloader=None,
      eval_dataloader=None,
      model_card=None,
  ):
      """
      Set up the trainer instance in operator before training and set trainer parameters.
      Args:
          training_config (`TrainingConfig`):
              The config of this trainer.
          train_dataset (`Union[Dataset, TowheeDataSet]`):
              Training dataset.
          eval_dataset (`Union[Dataset, TowheeDataSet]`):
              Evaluate dataset.
          train_dataloader (`Union[DataLoader, Iterable]`):
              If specified, `Trainer` will use it to load training data.
              Otherwise, `Trainer` will build dataloader from train_dataset.
          eval_dataloader (`Union[DataLoader, Iterable]`):
              If specified, `Trainer` will use it to load evaluate data.
              Otherwise, `Trainer` will build dataloader from train_dataset.
          model_card (`ModelCard`):
              Model card contains the training informations.
      Returns:
  
      """
      from towhee.trainer.trainer import (
          Trainer,
      )  # pylint: disable=import-outside-toplevel
      import torch  # pylint: disable=import-outside-toplevel
  
      if self._trainer is None:
          if isinstance(self.model, torch.nn.Module):
              training_model = self.model
          elif hasattr(self, "_model") and isinstance(
              self._model, torch.nn.Module
          ):
              training_model = self._model
          else:
              raise AttributeError(
                  "There is no trainable model attr in this operator."
              )
          self._trainer = Trainer(
              training_model,
              training_config,
              train_dataset,
              eval_dataset,
              train_dataloader,
              eval_dataloader,
              model_card,
          )
      else:
          if training_config is not None:
              self._trainer.configs = training_config
          if train_dataset is not None:
              self._trainer.train_dataset = train_dataset
          if eval_dataset is not None:
              self._trainer.eval_dataset = eval_dataset
          if train_dataloader is not None:
              self._trainer.train_dataloader = train_dataloader
          if eval_dataloader is not None:
              self._trainer.eval_dataloader = eval_dataloader
          if model_card is not None:
              self._trainer.model_card = model_card
  
imports: from abc import abstractmethod, ABC
  from enum import Enum
  from enum import Flag, auto
label_desc: Use image node_id 10 for calling the NNOperator obj's underlying member method code with example usage: obj.setup_trainer(training_config, train_dataset, eval_dataset, train_dataloader, eval_dataloader, model_card) without return types