pytorch-lightning icon indicating copy to clipboard operation
pytorch-lightning copied to clipboard

feat: Default to RichProgressBar and RichModelSummary if rich is avai…

Open littlebullGit opened this issue 7 months ago • 0 comments

What does this PR do?

This PR implements automatic detection of the optional rich package. If rich is available in the environment, PyTorch Lightning will now default to using RichProgressBar and RichModelSummary for an enhanced visual experience during training and model summarization. If rich is not available, it gracefully falls back to the standard TQDMProgressBar and ModelSummary.

This change aims to improve the out-of-the-box user experience by providing richer feedback mechanisms without requiring manual configuration when rich is installed. The existing behavior of respecting user-provided callbacks or explicit disabling of progress bars/model summaries is maintained.

The rich package is an optional dependency to enable the new default behaviors. If not present, the existing default callbacks are used.

Fixes #9580

No breaking changes are introduced by this PR.

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs) (Yes, issue #9580)
  • [X] Did you read the contributor guideline, Pull Request section? (Assumed)
  • [X] Did you make sure your PR does only one thing, instead of bundling different changes together? (Yes)
  • Did you make sure to update the documentation with your changes? (if necessary) (No explicit documentation changes were made in this PR. The behavior change is user-facing, and a note in relevant documentation sections might be beneficial as a follow-up.)
  • Did you write any new necessary tests? (not for typos and docs) (Yes, comprehensive tests were added in the test file tests/tests_pytorch/trainer/connectors/test_rich_integration.py.)
  • [X] Did you verify new and existing tests pass locally with your changes? (Yes)
  • Did you list all the breaking changes introduced by this pull request? (Yes, none.)
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors) (Yes, this is a feature enhancement and should be added to the changelog.)

Changelog Entry Suggestion (for CHANGELOG.md):

### Added

- Default to RichProgressBar and RichModelSummary if the rich package is available. Fallback to TQDMProgressBar and ModelSummary otherwise. (#9580)


<!-- readthedocs-preview pytorch-lightning start -->
----
📚 Documentation preview 📚: https://pytorch-lightning--20896.org.readthedocs.build/en/20896/

<!-- readthedocs-preview pytorch-lightning end -->

littlebullGit avatar Jun 12 '25 03:06 littlebullGit