TrainingCallbacks

Training Callbacks for training monitoring integrated in pythae (inspired from https://github.com/huggingface/transformers/blob/master/src/transformers/trainer_callback.py)

class pythae.trainers.training_callbacks.TrainingCallback[source]

Base class for creating training callbacks

on_epoch_begin(training_config, **kwargs)[source]

Event called at the beginning of an epoch.

on_epoch_end(training_config, **kwargs)[source]

Event called at the end of an epoch.

on_eval_step_begin(training_config, **kwargs)[source]

Event called at the beginning of a evaluation step.

on_eval_step_end(training_config, **kwargs)[source]

Event called at the end of a evaluation step.

on_evaluate(training_config, **kwargs)[source]

Event called after an evaluation phase.

on_init_end(training_config, **kwargs)[source]

Event called at the end of the initialization of the [Trainer].

on_log(training_config, logs, **kwargs)[source]

Event called after logging the last logs.

on_prediction_step(training_config, **kwargs)[source]

Event called after a prediction phase.

on_save(training_config, **kwargs)[source]

Event called after a checkpoint save.

on_train_begin(training_config, **kwargs)[source]

Event called at the beginning of training.

on_train_end(training_config, **kwargs)[source]

Event called at the end of training.

on_train_step_begin(training_config, **kwargs)[source]

Event called at the beginning of a training step.

on_train_step_end(training_config, **kwargs)[source]

Event called at the end of a training step.

class pythae.trainers.training_callbacks.CallbackHandler(callbacks, model)[source]

Class to handle list of Callback.

class pythae.trainers.training_callbacks.MetricConsolePrinterCallback[source]

A TrainingCallback printing the training logs in the console.

on_log(training_config, logs, **kwargs)[source]

Event called after logging the last logs.

class pythae.trainers.training_callbacks.ProgressBarCallback[source]

A TrainingCallback printing the training progress bar.

on_epoch_end(training_config, **kwags)[source]

Event called at the end of an epoch.

on_eval_step_begin(training_config, **kwargs)[source]

Event called at the beginning of a evaluation step.

on_eval_step_end(training_config, **kwargs)[source]

Event called at the end of a evaluation step.

on_train_step_begin(training_config, **kwargs)[source]

Event called at the beginning of a training step.

on_train_step_end(training_config, **kwargs)[source]

Event called at the end of a training step.

class pythae.trainers.training_callbacks.WandbCallback[source]

A TrainingCallback integrating the experiment tracking tool wandb (https://wandb.ai/).

It allows users to store their configs, monitor their trainings and compare runs through a graphic interface. To be able use this feature you will need:

  • a valid wandb account

  • the package wandb installed in your virtual env. If not you can install it with

$ pip install wandb
  • to be logged in to your wandb account using

$ wandb login
on_log(training_config, logs, **kwargs)[source]

Event called after logging the last logs.

on_prediction_step(training_config, **kwargs)[source]

Event called after a prediction phase.

on_train_begin(training_config, **kwargs)[source]

Event called at the beginning of training.

on_train_end(training_config, **kwargs)[source]

Event called at the end of training.

setup(training_config, model_config=None, project_name='pythae_experiment', entity_name=None, **kwargs)[source]

Setup the WandbCallback.

Parameters
  • training_config (BaseTrainerConfig) – The training configuration used in the run.

  • model_config (BaseAEConfig) – The model configuration used in the run.

  • project_name (str) – The name of the wandb project to use.

  • entity_name (str) – The name of the wandb entity to use.

class pythae.trainers.training_callbacks.MLFlowCallback[source]

A TrainingCallback integrating the experiment tracking tool mlflow (https://mlflow.org/).

It allows users to store their configs, monitor their trainings and compare runs through a graphic interface. To be able use this feature you will need:

  • the package mlfow installed in your virtual env. If not you can install it with

$ pip install mlflow
on_log(training_config, logs, **kwargs)[source]

Event called after logging the last logs.

on_train_begin(training_config, **kwargs)[source]

Event called at the beginning of training.

on_train_end(training_config, **kwargs)[source]

Event called at the end of training.

setup(training_config, model_config=None, run_name=None, **kwargs)[source]

Setup the MLflowCallback.

Parameters
  • training_config (BaseTrainerConfig) – The training configuration used in the run.

  • model_config (BaseAEConfig) – The model configuration used in the run.

  • run_name (str) – The name to apply to the current run.

class pythae.trainers.training_callbacks.CometCallback[source]

A TrainingCallback integrating the experiment tracking tool comet_ml (https://www.comet.com/site/).

It allows users to store their configs, monitor their trainings and compare runs through a graphic interface. To be able use this feature you will need:

  • the package comet_ml installed in your virtual env. If not you can install it with

$ pip install comet_ml
on_log(training_config, logs, **kwargs)[source]

Event called after logging the last logs.

on_prediction_step(training_config, **kwargs)[source]

Event called after a prediction phase.

on_train_begin(training_config, **kwargs)[source]

Event called at the beginning of training.

on_train_end(training_config, **kwargs)[source]

Event called at the end of training.

setup(training_config, model_config=None, api_key=None, project_name='pythae_experiment', workspace=None, offline_run=False, offline_directory='./', **kwargs)[source]

Setup the CometCallback.

Parameters
  • training_config (BaseTraineronfig) – The training configuration used in the run.

  • model_config (BaseAEConfig) – The model configuration used in the run.

  • api_key (str) – Your personal comet-ml api_key.

  • project_name (str) – The name of the wandb project to use.

  • workspace (str) – The name of your comet-ml workspace

  • offline_run – (bool): Whether to run comet-ml in offline mode.

  • offline_directory (str) – The path to store the offline runs. They can to be synchronized then by running comet upload.