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
...

NeptuneLogger

class catalyst.loggers.neptune.NeptuneLogger(base_namespace=None, api_token=None, project=None, run=None, **neptune_run_kwargs)[source]

Bases: catalyst.core.logger.ILogger

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

Neptune documentation: https://docs.neptune.ai

You can acquire api_token by following: https://docs.neptune.ai/getting-started/installation#authentication or, you can use special token ‘ANONYMOUS’ for testing without registration if not provided, Neptune will try to use environmental variable NEPTUNE_API_TOKEN

If using ‘ANONYMOUS’ token, you can set project to ‘common/catalyst-integration’ for test purposes.

Additional keyword arguments will be passed directly to neptune.init() function, see https://docs.neptune.ai/api-reference/neptune#init

After creation of the logger without passing run parameter, a link to created run will be printed. You can also retrieve the run object by calling NeptuneLogger.run to access it directly

Parameters
  • base_namespace – Optional. namespace within Neptune’s Run to put all metric in

  • api_token – Optional. Your Neptune API token. Use ‘ANONYMOUS’ for common, public access

  • project – Optional. Name of your workspace in a form of ‘workspaceName/projectName’

  • run – Optional. Pass if you want to resume a Neptune run.

Python API examples:

from catalyst import dl

runner = dl.SupervisedRunner()
runner.train(
    ...,
    loggers={"neptune": dl.NeptuneLogger(
        base_namespace="catalyst-tests",
        api_token="ANONYMOUS",
        project="common/catalyst-integration")
    }
)
from catalyst import dl

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

    def get_loggers(self):
        return {
            "console": dl.ConsoleLogger(),
            "neptune": dl.NeptuneLogger(
                base_namespace="catalyst-tests",
                api_token="ANONYMOUS",
                project="common/catalyst-integration")
        }
    # ...

runner = CustomRunner().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
...

WandbLogger

class catalyst.loggers.wandb.WandbLogger(project: str, name: Optional[str] = None, entity: Optional[str] = None)[source]

Bases: catalyst.core.logger.ILogger

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

W&B documentation: https://docs.wandb.com

Parameters
  • Project – Name of the project in W&B to log to.

  • name – Name of the run in W&B to log to.

  • config – Configuration Dictionary for the experiment.

  • entity – Name of W&B entity(team) to log to.

Python API examples:

from catalyst import dl

runner = dl.SupervisedRunner()
runner.train(
    ...,
    loggers={"wandb": dl.WandbLogger(project="wandb_test", name="expeirment_1")}
)
from catalyst import dl

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

    def get_loggers(self):
        return {
            "console": dl.ConsoleLogger(),
            "wandb": dl.WandbLogger(project="wandb_test", name="experiment_1")
        }

    # ...

runner = CustomRunner().run()

Config API example:

loggers:
    wandb:
        _target_: WandbLogger
        project: test_exp
        name: test_run
...

Hydra API example:

loggers:
    wandb:
        _target_: catalyst.dl.WandbLogger
        project: test_exp
        name: test_run
...