MolecularDiffusion.core.logger

Classes

LoggerBase

Base class for loggers.

LoggingLogger

Log outputs with the builtin logging module of Python.

WandbLogger

Log outputs with Weights and Biases and track the experiment progress.

Module Contents

class MolecularDiffusion.core.logger.LoggerBase

Bases: object

Base class for loggers.

Any custom logger should be derived from this class.

abstractmethod log(record, step_id, category='train/batch')

Log a record.

Parameters:
  • record (dict) – dict of any metric

  • step_id (int) – index of this log step

  • category (str, optional) – log category. Available types are train/batch, train/epoch, valid/epoch and test/epoch.

abstractmethod log_config(config)

Log a hyperparameter config.

Parameters:

config (dict) – hyperparameter config

class MolecularDiffusion.core.logger.LoggingLogger

Bases: LoggerBase

Log outputs with the builtin logging module of Python.

By default, the logs will be printed to the console. To additionally log outputs to a file, add the following lines in the beginning of your code.

log(record, step_id, category='train/batch')

Log a record.

Parameters:
  • record (dict) – dict of any metric

  • step_id (int) – index of this log step

  • category (str, optional) – log category. Available types are train/batch, train/epoch, valid/epoch and test/epoch.

log_config(config)

Log a hyperparameter config.

Parameters:

config (dict) – hyperparameter config

logger
class MolecularDiffusion.core.logger.WandbLogger(project=None, name=None, dir=None, rank=0, **kwargs)

Bases: LoggingLogger

Log outputs with Weights and Biases and track the experiment progress.

Note this class also output logs with the builtin logging module.

See wandb.init for more details.

Parameters:
  • project (str, optional) – name of the project

  • name (str, optional) – name of this run

  • dir (str, optional) – path to store meta data. Default is ./wandb.

  • kwargs – keyword arguments for wandb.init

log(record, step_id, category='train/batch')

Log a record.

Parameters:
  • record (dict) – dict of any metric

  • step_id (int) – index of this log step

  • category (str, optional) – log category. Available types are train/batch, train/epoch, valid/epoch and test/epoch.

log_config(confg_dict)

Log a hyperparameter config.

Parameters:

config (dict) – hyperparameter config