Shortcuts

Loggers

ConsoleLogger

class catalyst.loggers.console.ConsoleLogger(log_hparams: bool = False, log_loader_metrics: bool = True, log_epoch_metrics: bool = True)[source]

Bases: catalyst.core.logger.ILogger

Console logger for parameters and metrics. Output the metric into the console during experiment.

Parameters
  • log_hparams – boolean flag to print all hparams to the console (default: False)

  • log_loader_metrics – boolean flag to print loader metrics to the console (default: True)

  • log_epoch_metrics – boolean flag to print epoch metrics to the console (default: True)

Note

This logger is used by default by all Runners.

CSVLogger

class catalyst.loggers.csv.CSVLogger(logdir: str, use_logdir_postfix: bool = False)[source]

Bases: catalyst.core.logger.ILogger

CSV logger for the metrics storing under .csv file.

Parameters
  • logdir – path to logdir for the logger

  • use_logdir_postfix – boolean flag to use extra logs prefix in the logdir

Note

This logger is used by default by dl.Runner and dl.SupervisedRunner in case of specified logdir during runner.train(..., logdir=/path/to/logdir).

Note

This logger is used by default by dl.ConfigRunner and dl.HydraRunner in case of specified logdir in config args.

Notebook API examples:

from catalyst import dl

runner = dl.SupervisedRunner()
runner.train(
    ...,
    loggers={"csv": dl.CSVLogger(logdir="./logdir/logs"}
)
from catalyst import dl

class CustomRunner(dl.IRunner):
    # ...

    def get_loggers(self):
        return {
            "console": dl.ConsoleLogger(),
            "csv": dl.CSVLogger(logdir="./logdir/logs")
        }

    # ...

runner = CustomRunner().run()

Config API example:

loggers:
    csv:
        _target_: CSVLogger
        logdir: ./logdir/logs
...

Hydra API example:

loggers:
    csv:
        _target_: catalyst.dl.CSVLogger
        logdir: ./logdir/logs
...

MLflowLogger

class catalyst.loggers.mlflow.MLflowLogger(experiment: str, run: Optional[str] = None, tracking_uri: Optional[str] = None, registry_uri: Optional[str] = None)[source]

Bases: catalyst.core.logger.ILogger

Mlflow logger for parameters, metrics, images and other artifacts.

Mlflow documentation: https://mlflow.org/docs/latest/index.html.

Parameters
  • experiment – Name of the experiment in MLflow to log to.

  • run – Name of the run in Mlflow to log to.

  • tracking_uri – URI of tracking server against which to log run information related.

  • registry_uri – Address of local or remote model registry server.

Python API examples:

from catalyst import dl

runner = dl.SupervisedRunner()
runner.train(
    ...,
    loggers={"mlflow": dl.MLflowLogger(experiment="test_exp", run="test_run")}
)
from catalyst import dl

class CustomRunner(dl.IRunner):
    # ...

    def get_loggers(self):
        return {
            "console": dl.ConsoleLogger(),
            "mlflow": dl.MLflowLogger(experiment="test_exp", run="test_run")
        }

    # ...

runner = CustomRunner().run()

Config API example:

loggers:
    mlflow:
        _target_: MLflowLogger
        experiment: test_exp
        run: test_run
...

Hydra API example:

loggers:
    mlflow:
        _target_: catalyst.dl.MLflowLogger
        experiment: test_exp
        run: test_run
...

TensorboardLogger

class catalyst.loggers.tensorboard.TensorboardLogger(logdir: str, use_logdir_postfix: bool = False)[source]

Bases: catalyst.core.logger.ILogger

Tensorboard logger for parameters, metrics, images and other artifacts.

Parameters
  • logdir – path to logdir for tensorboard

  • use_logdir_postfix – boolean flag to use extra tensorboard prefix in the logdir

Note

This logger is used by default by dl.Runner and dl.SupervisedRunner in case of specified logdir during runner.train(..., logdir=/path/to/logdir).

Note

This logger is used by default by dl.ConfigRunner and dl.HydraRunner in case of specified logdir in config args.

Notebook API examples:

from catalyst import dl

runner = dl.SupervisedRunner()
runner.train(
    ...,
    loggers={"tensorboard": dl.TensorboardLogger(logdir="./logdir/tensorboard"}
)
from catalyst import dl

class CustomRunner(dl.IRunner):
    # ...

    def get_loggers(self):
        return {
            "console": dl.ConsoleLogger(),
            "tensorboard": dl.TensorboardLogger(logdir="./logdir/tensorboard")
        }

    # ...

runner = CustomRunner().run()

Config API example:

loggers:
    tensorboard:
        _target_: TensorboardLogger
        logdir: ./logdir/tensorboard
...

Hydra API example:

loggers:
    tensorboard:
        _target_: catalyst.dl.TensorboardLogger
        logdir: ./logdir/tensorboard
...