src.utils.logging package¶
Submodules¶
src.utils.logging.base_logger module¶
This file implements the base logger which is an interface for loggers.
- class src.utils.logging.base_logger.BaseLogger¶
Bases:
ABC
This class is the interface for all loggers.
- abstract log_end(data: Dict[str, Any]) None ¶
Logging function that is called after training for logging training statistics. For example, it can be used to parse tensorflows history object after it is returned after training.
- Parameters:
data – The dictionary containing training data and metrics.
- abstract log_epoch(data: Dict[str, Any]) None ¶
Logging function that is called every epoch for logging epoch statistics. For example, it can be used to save the epoch’s loss and metrics to the overall logging data.
- Parameters:
data – The dictionary containing epoch data and metrics.
- abstract log_start(data: Dict[str, Any]) None ¶
Logging function that is called before training for logging training parameters and metrics. For example, it can be used to save initialization parameters or configuration details.
- Parameters:
data – The dictionary containing data and config.
- save_logs(folder: str) None ¶
This function saves the gathered data in a json file for review and plotting the statistics later.
- Parameters:
folder – The folder to store the statistics in.
src.utils.logging.pytorch_logger module¶
Implement a logger for tensorflow keras models.
- class src.utils.logging.pytorch_logger.TorchLogger¶
Bases:
BaseLogger
Implements a logger for pytorch models that receives relevant values every epoch and creates the logs from them.
- log_end(data: Dict[str, Any]) None ¶
Log additional data at the end of the training if necessary.
- Parameters:
data – Data dictionary containing important logs.
- log_epoch(data: Dict[str, Any]) None ¶
Epoch logging method. Pass a loss, val_loss, acc and val_acc every epoch.
- Parameters:
data – Dictionary with data to log.
- log_start(data: Dict[str, Any]) None ¶
Log arbitrary data like training parameters etc.
- Parameters:
data – Data dictionary containing important data to log.
src.utils.logging.standard_logger module¶
This file implements the base logger which is an interface for loggers.
- class src.utils.logging.standard_logger.StandardLogger¶
Bases:
BaseLogger
This class is a standard logger that logs random dictionaries.
- log_end(data: Dict[str, Any]) None ¶
Logging function that is called after training for logging training statistics.
- Parameters:
data – The dictionary containing training data and metrics.
- log_epoch(data: Dict[str, Any]) None ¶
Logging function that is called every epoch for logging epoch statistics. For example, it can be used to save the epoch’s loss and metrics to the overall logging data.
- Parameters:
data – The dictionary containing epoch data and metrics.
- log_start(data: Dict[str, Any]) None ¶
Logging function that is called before training for logging training parameters and metrics. For example, it can be used to save initialization parameters or configuration details.
- Parameters:
data – The dictionary containing data and config.
src.utils.logging.tensorflow_logger module¶
Implement a logger for tensorflow keras models.
- class src.utils.logging.tensorflow_logger.KerasLogger¶
Bases:
BaseLogger
Implements a logger for keras models that uses tensorflow’s history object and extracts the logs from it.
- log_end(data: Dict[str, Any]) None ¶
Log all the gathered training logs from tensorflow and keras.
- Parameters:
data – Data dictionary containing important logs. history: We expect a history object to be present here.
- log_epoch(data: Dict[str, Any]) None ¶
Empty epoch logging method. Tensorflow logs all epoch logs itself and returns it in a history object. Therefore, no logging per epoch is required.
- Parameters:
data – Dictionary with data to log.
- log_start(data: Dict[str, Any]) None ¶
Log arbitrary data like training parameters etc.
- Parameters:
data – Data dictionary containing important data to log.
Module contents¶
Logging functionality is implemented in this package.