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

Logger support in Lite #16121

Merged
merged 21 commits into from
Jan 9, 2023

Conversation

lightningforever
Copy link
Contributor

@lightningforever lightningforever commented Dec 19, 2022

What does this PR do?

This PR adds the logger base class and TensorBoardLogger implementation to Fabric.

logger = TensorBoardLogger()
fabric = LightningLite(loggers=logger)

fabric.log("accuracy", acc)
fabric.log_dict({"accuracy": acc, "loss": loss})

The base class interface is mostly the same as in PyTorch Lightning, but with these key differences:

  • Removed model checkpoint callback dependency and after_save_checkpoint hook. Lite won't have the same checkpointing mechanism through callbacks, and thus we will have to rework the way loggers access checkpoints.
  • Removed DummyLogger (only needed for Trainer)
  • Moved properties to the top (code organization)
  • Property: save_dir -> root_dir. We are standardizing the way the log dir is defined, to be compatible with as many logger frameworks as possible. More info in Introduce Logger.experiment_dir #14188.

The TensorBoard implementation changes very little. Trainer-only features and dependencies were removed:

  • Removed hparams saving
  • Removed OmegaConf dependency
  • save_dir -> root_dir
  • Removed log_graph argument in constructor (logging graph is still supported through logger.log_graph())

Future Work:

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

No

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 update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is free to review the PR once the tests have passed.
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?

I made sure I had fun coding 🙃

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Dec 19, 2022
@lightningforever lightningforever changed the title Logger support in Lite WIP Logger support in Lite Dec 20, 2022
@lightningforever lightningforever changed the title WIP Logger support in Lite Logger support in Lite Dec 20, 2022
@github-actions github-actions bot removed the pl Generic label for PyTorch Lightning package label Dec 20, 2022
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGMT !

src/lightning_fabric/loggers/tensorboard.py Show resolved Hide resolved
@mergify mergify bot added the ready PRs ready to be merged label Dec 21, 2022
@mergify mergify bot added has conflicts ready PRs ready to be merged and removed ready PRs ready to be merged has conflicts labels Dec 22, 2022
@mergify mergify bot added has conflicts and removed ready PRs ready to be merged labels Jan 4, 2023
@mergify mergify bot added ready PRs ready to be merged and removed has conflicts ready PRs ready to be merged labels Jan 9, 2023
@github-actions github-actions bot removed the pl Generic label for PyTorch Lightning package label Jan 9, 2023
@mergify mergify bot added the ready PRs ready to be merged label Jan 9, 2023
@awaelchli awaelchli added the fabric lightning.fabric.Fabric label Jan 9, 2023
@awaelchli awaelchli added this to the v1.9 milestone Jan 9, 2023
@awaelchli awaelchli enabled auto-merge (squash) January 9, 2023 14:24
auto-merge was automatically disabled January 9, 2023 15:16

Head branch was pushed to by a user without write access

@awaelchli awaelchli enabled auto-merge (squash) January 9, 2023 15:35
@awaelchli awaelchli merged commit f24349b into Lightning-AI:master Jan 9, 2023
@lightningforever lightningforever deleted the lite/debug-logger branch January 9, 2023 18:46
@awaelchli awaelchli mentioned this pull request Jan 12, 2023
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fabric lightning.fabric.Fabric ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants