Skip to content

Lightning logger aggregation API deprecation #9145

@edward-io

Description

@edward-io

Proposed refactoring or deprecation

Move and/or deprecate aggregation-related code to individual loggers

Motivation

We are auditing the Lightning components and APIs to assess opportunities for improvements:

Revisiting some of the API decisions regarding aggregations in Lightning Logger to simplify the interface and move logic specific to individual loggers away from the base class:

  • Aggregation is currently being done by the step dimension. Users may want more control over complex aggregations, like aggregating metrics over a time window.
  • It's not clear to the end-user whether they should use agg_and_log_metrics or log_metrics. In LoggerConnector, when log_metrics is called, we call agg_and_log_metrics.
    • Which method(s) should developers override when creating their custom logger?
  • LightningLoggerBase.__init__ accepts two arguments, agg_key_funcs, and agg_default_func. They aren't being called in any sub-classed loggers within Lightning. They can be implementation details of the loggers instead.
    • Do we know if users are adding aggregation functionality using update_agg_funcs directly?

Pitch

  • Simplify LightningLoggerBase.__init__ by removing agg_key_funcs and agg_default_func
  • Move aggregation-related logger code out of base class to simplify the interface
  • Provide clarity between what the Lightning trainer calls between log_metrics and agg_and_log_metrics. Proposal: the trainer should only call log_metrics

Additional context

Related issues:

#8991

#9004


If you enjoy Lightning, check out our other projects! ⚡

  • Metrics: Machine learning metrics for distributed, scalable PyTorch applications.

  • Flash: The fastest way to get a Lightning baseline! A collection of tasks for fast prototyping, baselining, finetuning and solving problems with deep learning

  • Bolts: Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch

  • Lightning Transformers: Flexible interface for high performance research using SOTA Transformers leveraging Pytorch Lightning, Transformers, and Hydra.

Metadata

Metadata

Assignees

Labels

deprecationIncludes a deprecationfeatureIs an improvement or enhancementhelp wantedOpen to be worked onlet's do it!approved to implementloggerRelated to the Loggersrefactor

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions