Shortcuts

Loggers

CometLogger

class catalyst.loggers.comet.CometLogger(workspace: Optional[str] = None, project_name: Optional[str] = None, experiment_id: Optional[str] = None, comet_mode: str = 'online', tags: List[str] = None, logging_frequency: int = 1, log_batch_metrics: bool = False, log_epoch_metrics: bool = True, **experiment_kwargs: Dict)[source]

Bases: catalyst.core.logger.ILogger

Comet logger for parameters, metrics, images and other artifacts (videos, audio, model checkpoints, etc.).

You will need a Comet API Key to log your Catalyst runs to Comet. You can sign up for a free account here: https://www.comet.ml/signup

Check out our Quickstart Guide to learn more: https://www.comet.ml/docs/quick-start/.

Parameters
  • workspace – Workspace to log the experiment.

  • project_name – Project to log the experiment.

  • experiment_id – Experiment ID of a previously logged Experiment. Used to continue logging to an existing experiment (resume experiment).

  • comet_mode – Specifies whether to run an Online Experiment or Offline Experiment

  • tags – A list of tags to add to the Experiment.

  • experiment_kwargs – Used to pass additional arguments to the Experiment object

  • log_batch_metrics – boolean flag to log batch metrics (default: SETTINGS.log_batch_metrics or False).

  • log_epoch_metrics – boolean flag to log epoch metrics (default: SETTINGS.log_epoch_metrics or True).

Python API examples:

from catalyst import dl

runner = dl.SupervisedRunner()
runner.train(
    ...
    loggers={
        "comet": dl.CometLogger(
            project_name="my-comet-project"
        )
    }
)
from catalyst import dl

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

    def get_loggers(self):
        return {
            "console": dl.ConsoleLogger(),
            "comet": dl.CometLogger(
                project_name="my-comet-project"
            )
        }
    # ...

runner = CustomRunner().run()

ConsoleLogger

class catalyst.loggers.console.ConsoleLogger(log_hparams: bool = False)[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)

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

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()

MLflowLogger

class catalyst.loggers.mlflow.MLflowLogger(experiment: str, run: Optional[str] = None, tracking_uri: Optional[str] = None, registry_uri: Optional[str] = None, exclude: Optional[List[str]] = None, log_batch_metrics: bool = False, log_epoch_metrics: bool = True)[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.

  • exclude – Name of to exclude from logging.

  • log_batch_metrics – boolean flag to log batch metrics (default: SETTINGS.log_batch_metrics or False).

  • log_epoch_metrics – boolean flag to log epoch metrics (default: SETTINGS.log_epoch_metrics or True).

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()

NeptuneLogger

class catalyst.loggers.neptune.NeptuneLogger(base_namespace=None, api_token=None, project=None, run=None, log_batch_metrics: bool = False, log_epoch_metrics: bool = True, **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 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.

  • log_batch_metrics – boolean flag to log batch metrics (default: SETTINGS.log_batch_metrics or False).

  • log_epoch_metrics – boolean flag to log epoch metrics (default: SETTINGS.log_epoch_metrics or True).

  • 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()

TensorboardLogger

class catalyst.loggers.tensorboard.TensorboardLogger(logdir: str, use_logdir_postfix: bool = False, log_batch_metrics: bool = False, log_epoch_metrics: bool = True)[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.

  • log_batch_metrics – boolean flag to log batch metrics (default: SETTINGS.log_batch_metrics or False).

  • log_epoch_metrics – boolean flag to log epoch metrics (default: SETTINGS.log_epoch_metrics or True).

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

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()

WandbLogger

class catalyst.loggers.wandb.WandbLogger(project: str, name: Optional[str] = None, entity: Optional[str] = None, log_batch_metrics: bool = False, log_epoch_metrics: bool = True, **kwargs)[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.

  • log_batch_metrics – boolean flag to log batch metrics (default: SETTINGS.log_batch_metrics or False).

  • log_epoch_metrics – boolean flag to log epoch metrics (default: SETTINGS.log_epoch_metrics or True).

  • kwargs – Optional, additional keyword arguments to be passed directly to the wandb.init

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()