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 _check_dataset(self, dataset: BaseDataset):
      try:
          dataset_output = dataset[0]
  
      except Exception as e:
          raise DatasetError(
              "Error when trying to collect data from the dataset. Check `__getitem__` method. "
              "The Dataset should output a dictionnary with keys at least ['data']. "
              "Please check documentation.\n"
              f"Exception raised: {type(e)} with message: " + str(e)
          ) from e
  
      if "data" not in dataset_output.keys():
          raise DatasetError(
              "The Dataset should output a dictionnary with keys ['data']"
          )
  
      try:
          len(dataset)
  
      except Exception as e:
          raise DatasetError(
              "Error when trying to get dataset len. Check `__len__` method. "
              "Please check documentation.\n"
              f"Exception raised: {type(e)} with message: " + str(e)
          ) from e
  
      # check everything if fine when combined with data loader
      from torch.utils.data import DataLoader
  
      dataloader = DataLoader(
          dataset=dataset,
          batch_size=min(len(dataset), 2),
          collate_fn=collate_dataset_output,
      )
      loader_out = next(iter(dataloader))
      assert loader_out.data.shape[0] == min(
          len(dataset), 2
      ), "Error when combining dataset with loader."
  
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 2 for calling the TrainingPipeline obj's underlying member method code with example usage: obj._check_dataset(dataset) without return types