Skip to content

API reference: Catalyst integration#

You can use the Catalyst NeptuneLogger class to capture model training metadata.


NeptuneLogger#

Neptune logger for parameters, metrics, images and artifacts (such as videos, audio, and model checkpoints).

Parameters

Name         Type Default Description
base_namespace str, optional experiment Namespace under which all metadata logged by the Neptune logger will be stored.
api_token str, optional None User's API token. If None, the value of the NEPTUNE_API_TOKEN environment variable is used.

⚠ To keep your token secure, avoid placing it in the source code. Instead, save it as an environment variable.

project str, optional None Name of a project in the form workspace-name/project-name. If None, the value of the NEPTUNE_PROJECT environment variable is used.
run Run, optional None An existing run reference, as returned by neptune.init_run().
log_batch_metrics boolean, optional SETTINGS.log_batch_metrics or False Boolean flag to log batch metrics.
log_epoch_metrics boolean, optional SETTINGS.log_epoch_metrics or True Boolean flag to log epoch metrics.
**neptune_run_kwargs str, optional - Additional keyword arguments to be passed directly to the init_run() function, such as description and tags. If the run parameter is set to None, NeptuneLogger will create a Run object for you.

Examples

Add NeptuneLogger through the train() function:

from catalyst import dl
runner = dl.SupervisedRunner()
runner.train(
    ...
    loggers={
        "neptune": dl.NeptuneLogger(
            project="workspace-name/project-name", # (1)!
            tags=["pretraining", "retina"],  # kwargs for neptune.init_run()
        )
    }
)
  1. The full project name. For example, "ml-team/classification".

    • You can copy the name from the project details ( Details & privacy)
    • You can also find a pre-filled project string in Experiments Create a new run.

Add NeptuneLogger from within custom runner implementation:

from catalyst import dl
class CustomRunner(dl.IRunner):
    # ...
    def get_loggers(self):
        return {
            "console": dl.ConsoleLogger(),
            "neptune": dl.NeptuneLogger(project="workspace-name/project-name"),
        }
    # ...
runner = CustomRunner().run()

You can also add the Neptune logger through Config API and Hydra API:

# Config API
loggers:
    neptune:
        _target_: NeptuneLogger
        project: workspace-name/project-name
...
# Hydra API
loggers:
    neptune:
        _target_: catalyst.dl.NeptuneLogger
        project: workspace-name/project-name
        base_namespace: catalyst
...

See also