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","."]
code: def __init__(
      self,
      model: Optional[BaseAE],
      training_config: Optional[BaseTrainerConfig] = None,
  ):
      if training_config is None:
          if model.model_name == "RAE_L2":
              training_config = CoupledOptimizerTrainerConfig(
                  encoder_optimizer_params={"weight_decay": 0},
                  decoder_optimizer_params={
                      "weight_decay": model.model_config.reg_weight
                  },
              )
  
          elif (
              model.model_name == "Adversarial_AE"
              or model.model_name == "FactorVAE"
          ):
              training_config = AdversarialTrainerConfig()
  
          elif model.model_name == "VAEGAN":
              training_config = (
                  CoupledOptimizerAdversarialTrainerConfig()
              )
  
          else:
              training_config = BaseTrainerConfig()
  
      elif model.model_name == "RAE_L2" or model.model_name == "PIWAE":
          if not isinstance(
              training_config, CoupledOptimizerTrainerConfig
          ):
              raise AssertionError(
                  "A 'CoupledOptimizerTrainerConfig' "
                  f"is expected for training a {model.model_name}"
              )
          if model.model_name == "RAE_L2":
              if training_config.decoder_optimizer_params is None:
                  training_config.decoder_optimizer_params = {
                      "weight_decay": model.model_config.reg_weight
                  }
              else:
                  training_config.decoder_optimizer_params[
                      "weight_decay"
                  ] = model.model_config.reg_weight
  
      elif (
          model.model_name == "Adversarial_AE"
          or model.model_name == "FactorVAE"
      ):
          if not isinstance(training_config, AdversarialTrainerConfig):
              raise AssertionError(
                  "A 'AdversarialTrainer' "
                  f"is expected for training a {model.model_name}"
              )
  
      elif model.model_name == "VAEGAN":
          if not isinstance(
              training_config, CoupledOptimizerAdversarialTrainerConfig
          ):
              raise AssertionError(
                  "A 'CoupledOptimizerAdversarialTrainer' "
                  "is expected for training a VAEGAN"
              )
  
      if not isinstance(training_config, BaseTrainerConfig):
          raise AssertionError(
              "A 'BaseTrainerConfig' " "is expected for the pipeline"
          )
  
      self.data_processor = DataProcessor()
      self.model = model
      self.training_config = training_config
  
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 1 to create a new TrainingPipeline object from inherited base classes: Pipeline with example: obj = TrainingPipeline(model, training_config)