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 (videos, audio, model checkpoints, etc.).

Neptune documentation: https://docs.neptune.ai/integrations-and-supported-tools/model-training/catalyst

When the logger is created, link to the run in Neptune will be printed to stdout. It looks like this: https://ui.neptune.ai/common/catalyst-integration/e/CATALYST-1379

To start with Neptune please check Neptune getting-started docs because you will need api_token and project to log your Catalyst runs to.

Note

You can use public api_token ANONYMOUS and set project to common/catalyst-integration for testing without registration.

Parameters
  • base_namespace – Optional, str, root namespace within Neptune’s run. Default is “experiment”.

  • api_token – Optional, str. Your Neptune API token. Read more about it in the Neptune installation docs.

  • project – Optional, str. Name of the project to log runs to. It looks like this: “my_workspace/my_project”.

  • run – Optional, pass Neptune run object if you want to continue logging to the existing run (resume run). Read more about it here.

  • neptune_run_kwargs – Optional, additional keyword arguments to be passed directly to the neptune.init() function.

Python API examples:

from catalyst import dl

runner = dl.SupervisedRunner()
runner.train(
    ...
    loggers={
        "neptune": dl.NeptuneLogger(
            project="my_workspace/my_project",
            tags=["pretraining", "retina"],
        )
    }
)
from catalyst import dl

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

    def get_loggers(self):
        return {
            "console": dl.ConsoleLogger(),
            "neptune": dl.NeptuneLogger(
                project="my_workspace/my_project"
            )
        }
    # ...

runner = CustomRunner().run()

Config API example:

loggers:
    neptune:
        _target_: NeptuneLogger
        project: my_workspace/my_project
...

Hydra API example:

loggers:
    neptune:
        _target_: catalyst.dl.NeptuneLogger
        project: my_workspace/my_project
        base_namespace: catalyst
...

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