Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create loggers property for Trainer and LightningModule #11683

Merged

Conversation

akashkw
Copy link
Contributor

@akashkw akashkw commented Feb 1, 2022

What does this PR do?

Implement a loggers property that returns a list of loggers. This is meant to replace LoggerCollection, which will then be deprecated.

Part of #11232

Does your PR introduce any breaking changes? If yes, please list them.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

Make sure you had fun coding 🙃

@ananthsub ananthsub added this to the 1.6 milestone Feb 1, 2022
@ananthsub ananthsub added the logger Related to the Loggers label Feb 1, 2022
@akashkw akashkw force-pushed the refactor/create-loggers-property branch from edbdbb7 to 1ad542a Compare February 1, 2022 22:02
@akashkw akashkw force-pushed the refactor/create-loggers-property branch from 95e173b to 9d564d8 Compare February 1, 2022 22:22
@akashkw akashkw marked this pull request as ready for review February 1, 2022 22:24
docs/source/common/trainer.rst Outdated Show resolved Hide resolved
pytorch_lightning/core/lightning.py Outdated Show resolved Hide resolved
Copy link
Contributor

@daniellepintz daniellepintz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@akashkw
Copy link
Contributor Author

akashkw commented Feb 4, 2022

We are going to handle the special case for the loggers setter where someone assigns trainer.loggers = [LoggerCollection]
This will make it easier to refactor the codebase such that anywhere the user passes in a logger, we can easily put it in a list and assign it to trainer.loggers.

If we try to manually check and sanitize this everywhere it occurs in the codebase, it will be harder to deprecate LoggerCollection and trainer.logger. Sanitizing the input to trainer.loggers would also remove information about whether the user provided a LoggerCollection, which would lead to incorrect behavior if the LoggerCollection is of size 1. There are multiple solutions to this problem but, in my opinion, they are all messier than adding a special case to the setter.

@daniellepintz
Copy link
Contributor

Could someone please rerun the CI and enable auto-merge?

docs/source/common/lightning_module.rst Outdated Show resolved Hide resolved
pytorch_lightning/trainer/trainer.py Outdated Show resolved Hide resolved
@daniellepintz
Copy link
Contributor

Can we update this PR to include the proposal in #11232 (comment)?

@mergify mergify bot added the has conflicts label Feb 9, 2022
docs/source/common/lightning_module.rst Show resolved Hide resolved
docs/source/common/trainer.rst Outdated Show resolved Hide resolved
docs/source/common/trainer.rst Outdated Show resolved Hide resolved
pytorch_lightning/trainer/trainer.py Show resolved Hide resolved
pytorch_lightning/trainer/trainer.py Outdated Show resolved Hide resolved
Co-authored-by: ananthsub <ananth.subramaniam@gmail.com>
auto-merge was automatically disabled February 9, 2022 18:44

Head branch was pushed to by a user without write access

@mergify mergify bot removed the has conflicts label Feb 9, 2022
Copy link
Contributor

@daniellepintz daniellepintz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for your persistence on this. I think it's ready to merge

@awaelchli awaelchli merged commit a2d8c4f into Lightning-AI:master Feb 9, 2022
@akashkw akashkw deleted the refactor/create-loggers-property branch February 9, 2022 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logger Related to the Loggers ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants