GenerationPipeline

class pythae.pipelines.GenerationPipeline(model, sampler_config=None)[source]

This Pipeline provides an end to end way to generate samples from a trained VAE model. It only needs a pythae.models to sample from and a smapler configuration.

Parameters
  • model (Optional[BaseAE]) – An instance of BaseAE you want to train. If None, a default VAE model is used. Default: None.

  • training_config (Optional[BaseTrainerConfig]) – An instance of BaseTrainerConfig stating the training parameters. If None, a default configuration is used.

__call__(num_samples=1, batch_size=500, output_dir=None, return_gen=True, save_sampler_config=False, train_data=None, eval_data=None, training_config=None)[source]

Launch the model training on the provided data.

Parameters
  • num_samples (int) – The number of samples to generate

  • batch_size (int) – The batch size to use during sampling

  • output_dir (str) – The directory where the images will be saved. If does not exist the folder is created. If None: the images are not saved. Defaults: None.

  • return_gen (bool) – Whether the sampler should directly return a tensor of generated data. Default: True.

  • training_data (Union[ndarray, Tensor]) – The training data as a numpy.ndarray or torch.Tensor of shape (mini_batch x n_channels x …) if the sampler needs to be trained (e.g. flow based samplers). Default: None.

  • eval_data (Optional[Union[ndarray, Tensor]]) – The evaluation data as a numpy.ndarray or torch.Tensor of shape (mini_batch x n_channels x …) if the sampler needs to be trained (e.g. flow based samplers). Default: None.

  • training_config (BaseTrainerConfig) – the training config to use if the sampler needs to be trained (e.g. flow based samplers). Default: None.

  • callbacks (List[TrainingCallbacks]) – A list of callbacks to use during training.