NeptuneLogger#

class composer.loggers.NeptuneLogger(*, project=None, api_token=None, rank_zero_only=True, upload_artifacts=False, base_namespace='training', **neptune_kwargs)[source]#

Log to neptune.ai.

For more, see the [Neptune-Composer integration guide](https://docs.neptune.ai/integrations/composer/).

Parameters
  • project (str, optional) โ€“ The name of your Neptune project, in the form โ€œworkspace-name/project-nameโ€. If you leave it empty, the NEPTUNE_PROJECT environment variable will be used.

  • api_token (str, optional) โ€“ Your Neptune API token. You can leave out this argument if you save your token to the NEPTUNE_API_TOKEN environment variable (recommended). You can find your API token in the user menu of the Neptune web app.

  • rank_zero_only (bool, optional) โ€“ Whether to log only on the rank-zero process. (default: True).

  • upload_artifacts (bool, optional) โ€“ Whether the logger should upload artifacts to Neptune. (default: False).

  • base_namespace (str, optional) โ€“ The name of the base namespace to log the metadata to. (default: โ€œtrainingโ€).

  • neptune_kwargs (Dict[str, Any], optional) โ€“ Any additional keyword arguments to the neptune.init_run() function. For options, see the Run API reference in the Neptune docs.

property base_handler#

Gets a handler for the base logging namespace.

Use the handler to log extra metadata to the run and organize it under the base namespace (default: โ€œtrainingโ€). You can operate on it like a run object: Access a path inside the handler and assign metadata to it with โ€œ=โ€ or other [Neptune logging methods](https://docs.neptune.ai/logging/methods/).

Example

from composer import Trainer from composer.loggers import NeptuneLogger neptune_logger = NeptuneLogger() trainer = Trainer(loggers=neptune_logger, โ€ฆ) trainer.fit() neptune_logger.base_handler[โ€œsome_metricโ€] = 1 trainer.close()

Result: The value 1 is organized under โ€œtraining/some_metricโ€ inside the run.

can_upload_files()[source]#

Whether the logger supports uploading files.

property neptune_run#

Gets the Neptune run object from a NeptuneLogger instance.

You can log additional metadata to the run by accessing a path inside the run and assigning metadata to it with โ€œ=โ€ or [Neptune logging methods](https://docs.neptune.ai/logging/methods/).

Example

from composer import Trainer from composer.loggers import NeptuneLogger neptune_logger = NeptuneLogger() trainer = Trainer(loggers=neptune_logger, โ€ฆ) trainer.fit() neptune_logger.neptune_run[โ€œsome_metricโ€] = 1 trainer.close()