class_docstr: This Pipeline provides an end to end way to train your VAE model.
  The trained model will be saved in ``output_dir`` stated in the
  :class:`~pythae.trainers.BaseTrainerConfig`. A folder
  ``training_YYYY-MM-DD_hh-mm-ss`` is
  created where checkpoints and final model will be saved. Checkpoints are saved in
  ``checkpoint_epoch_{epoch}`` folder (optimizer and training config
  saved as well to resume training if needed)
  and the final model is saved in a ``final_model`` folder. If ``output_dir`` is
  None, data is saved in ``dummy_output_dir/training_YYYY-MM-DD_hh-mm-ss`` is created.
  
  Parameters:
  
      model (Optional[BaseAE]): An instance of :class:`~pythae.models.BaseAE` you want to train.
          If None, a default :class:`~pythae.models.VAE` model is used. Default: None.
  
      training_config (Optional[BaseTrainerConfig]): An instance of
          :class:`~pythae.trainers.BaseTrainerConfig` stating the training
          parameters. If None, a default configuration is used.
class_docstr_tok: ["This","Pipeline","provides","an","end","to","end","way","to","train","your","VAE","model",".","The","trained","model","will","be","saved","in","``","output_dir","``","stated","in","the",":","class",":","`","~pythae.trainers.BaseTrainerConfig","`",".","A","folder","``","training_YYYY-MM-DD_hh-mm-ss","``","is","created","where","checkpoints","and","final","model","will","be","saved",".","Checkpoints","are","saved","in","``","checkpoint_epoch_","{","epoch","}","``","folder","(","optimizer","and","training","config","saved","as","well","to","resume","training","if","needed",")","and","the","final","model","is","saved","in","a","``","final_model","``","folder",".","If","``","output_dir","``","is","None",",","data","is","saved","in","``","dummy_output_dir\/training_YYYY-MM-DD_hh-mm-ss","``","is","created",".","Parameters",":","model","(","Optional","[","BaseAE","]",")",":","An","instance","of",":","class",":","`","~pythae.models.BaseAE","`","you","want","to","train",".","If","None",",","a","default",":","class",":","`","~pythae.models.VAE","`","model","is","used",".","Default",":","None",".","training_config","(","Optional","[","BaseTrainerConfig","]",")",":","An","instance","of",":","class",":","`","~pythae.trainers.BaseTrainerConfig","`","stating","the","training","parameters",".","If","None",",","a","default","configuration","is","used","."]
docstr: Launch the model training on the provided data.
  
  Args:
      train_data: The training data or DataLoader.
  
      eval_data: The evaluation data or DataLoader. If None, only uses train_data for training. Default: None
  
      callbacks (List[~pythae.trainers.training_callbacks.TrainingCallbacks]):
          A list of callbacks to use during training.
docstr_tok: ["Launch","the","model","training","on","the","provided","data",".","Args",":","train_data",":","The","training","data","or","DataLoader",".","eval_data",":","The","evaluation","data","or","DataLoader",".","If","None",",","only","uses","train_data","for","training",".","Default",":","None","callbacks","(","List","[","~pythae.trainers.training_callbacks.TrainingCallbacks","]",")",":","A","list","of","callbacks","to","use","during","training","."]
code: def __call__(
      self,
      train_data: Union[
          np.ndarray,
          torch.Tensor,
          torch.utils.data.Dataset,
          torch.utils.data.DataLoader,
      ] = None,
      eval_data: Union[
          np.ndarray,
          torch.Tensor,
          torch.utils.data.Dataset,
          torch.utils.data.DataLoader,
      ] = None,
      callbacks: List[TrainingCallback] = None,
  ):
      """
      Launch the model training on the provided data.
  
      Args:
          train_data: The training data or DataLoader.
  
          eval_data: The evaluation data or DataLoader. If None, only uses train_data for training. Default: None
  
          callbacks (List[~pythae.trainers.training_callbacks.TrainingCallbacks]):
              A list of callbacks to use during training.
      """
  
      # Initialize variables for datasets and dataloaders
      train_dataset, eval_dataset = None, None
      train_dataloader, eval_dataloader = None, None
  
      if isinstance(train_data, torch.utils.data.DataLoader):
          train_dataloader = train_data
      elif isinstance(train_data, (np.ndarray, torch.Tensor)):
          logger.info("Preprocessing train data...")
          train_data = self.data_processor.process_data(train_data)
          train_dataset = self.data_processor.to_dataset(train_data)
          logger.info("Checking train dataset...")
          self._check_dataset(train_dataset)
      else:
          train_dataset = train_data
          logger.info("Checking train dataset...")
          self._check_dataset(train_dataset)
  
      if eval_data is not None:
          if isinstance(eval_data, torch.utils.data.DataLoader):
              eval_dataloader = eval_data
          elif isinstance(eval_data, (np.ndarray, torch.Tensor)):
              logger.info("Preprocessing eval data...\n")
              eval_data = self.data_processor.process_data(eval_data)
              eval_dataset = self.data_processor.to_dataset(eval_data)
              logger.info("Checking eval dataset...")
              self._check_dataset(eval_dataset)
          else:
              eval_dataset = eval_data
              logger.info("Checking eval dataset...")
              self._check_dataset(eval_dataset)
  
      if isinstance(
          self.training_config, CoupledOptimizerTrainerConfig
      ):
          logger.info("Using Coupled Optimizer Trainer\n")
          trainer = CoupledOptimizerTrainer(
              model=self.model,
              train_dataset=train_dataloader or train_dataset,
              eval_dataset=eval_dataloader or eval_dataset,
              training_config=self.training_config,
              callbacks=callbacks,
          )
  
      elif isinstance(self.training_config, AdversarialTrainerConfig):
          logger.info("Using Adversarial Trainer\n")
          trainer = AdversarialTrainer(
              model=self.model,
              train_dataset=train_dataloader or train_dataset,
              eval_dataset=eval_dataloader or eval_dataset,
              training_config=self.training_config,
              callbacks=callbacks,
          )
  
      elif isinstance(
          self.training_config, CoupledOptimizerAdversarialTrainerConfig
      ):
          logger.info("Using Coupled Optimizer Adversarial Trainer\n")
          trainer = CoupledOptimizerAdversarialTrainer(
              model=self.model,
              train_dataset=train_dataloader or train_dataset,
              eval_dataset=eval_dataloader or eval_dataset,
              training_config=self.training_config,
              callbacks=callbacks,
          )
  
      elif isinstance(self.training_config, BaseTrainerConfig):
          logger.info("Using Base Trainer\n")
          trainer = BaseTrainer(
              model=self.model,
              train_dataset=train_dataloader or train_dataset,
              eval_dataset=eval_dataloader or eval_dataset,
              training_config=self.training_config,
              callbacks=callbacks,
          )
      else:
          raise ValueError(
              "The provided training config is not supported."
          )
  
      self.trainer = trainer
      trainer.train()
  
file_path: benchmark_VAE/src/pythae/pipelines/training.py
imports: import logging
  from typing import List, Optional, Union
  import numpy
  import torch
  from ..customexception import DatasetError
  from ..data.datasets import collate_dataset_output
  from ..data.preprocessors import BaseDataset, DataProcessor
  from ..models import BaseAE
  from ..trainers import *
  from ..trainers.training_callbacks import TrainingCallback
  from .base_pipeline import Pipeline
label_desc: Use image node_id 3 for calling the TrainingPipeline obj's underlying member method code with example usage: obj.__call__(train_data, eval_data, callbacks) without return types