-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat: Default to RichProgressBar and RichModelSummary if rich is avai… #20896
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
base: master
Are you sure you want to change the base?
feat: Default to RichProgressBar and RichModelSummary if rich is avai… #20896
Conversation
tests/tests_pytorch/callbacks/progress/test_tqdm_progress_bar.py
Outdated
Show resolved
Hide resolved
tests/tests_pytorch/callbacks/progress/test_tqdm_progress_bar.py
Outdated
Show resolved
Hide resolved
f8081b0
to
929c530
Compare
0e502fa
to
8f97b42
Compare
pls add it as part of your PR :) |
tests/tests_pytorch/trainer/connectors/test_rich_integration.py
Outdated
Show resolved
Hide resolved
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://lightning.ai/docs/pytorch/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Discord. Thank you for your contributions. |
…lable Implements automatic detection of the 'rich' package and enables RichProgressBar and RichModelSummary by default in the Trainer when the package is present. This enhances the user experience with improved visual feedback without requiring manual configuration. Includes comprehensive tests for various scenarios. Fixes Lightning-AI#9580
…and rich progress bars
The RichProgressBar was failing in multi-GPU environments because it could not handle tensor metrics from different devices. This commit overrides the get_metrics method to convert all tensor metrics to floats before they are rendered, preventing errors. An accompanying test is added to verify the fix.
The test_progress_bar_max_val_check_interval_ddp test was failing in CI due to an AttributeError. This occurred because _RICH_AVAILABLE was not mocked, leading to RichProgressBar being used incorrectly. This commit adds the necessary @patch decorator to ensure TQDMProgressBar is instantiated as expected.
Addresses a PR comment by bhimrazy regarding inconsistent _RICH_AVAILABLE checks. This commit: 1. Defines _RICH_MIN_VERSION = "10.2.2" in utilities/imports.py. 2. Updates _RICH_AVAILABLE in utilities/imports.py to use this minimum version. 3. Modifies callbacks/progress/rich_progress.py to import and use the centralized _RICH_AVAILABLE from utilities/imports.py, removing its local definition. This ensures a single source of truth for rich package availability and version checking.
Co-authored-by: Bhimraj Yadav <[email protected]>
Fixes import statements in files that were still importing _RICH_AVAILABLE from rich_progress.py instead of the centralized utilities.imports. Updated files: - src/lightning/pytorch/callbacks/rich_model_summary.py - src/lightning/pytorch/loops/evaluation_loop.py - src/lightning/pytorch/utilities/testing/_runif.py - tests/tests_pytorch/trainer/logging_/test_eval_loop_logging.py This completes the centralization of _RICH_AVAILABLE checks.
Added entry to CHANGELOG.md documenting the new feature that defaults to RichProgressBar and RichModelSummary when the rich package is available, with fallback to TQDM variants.
c8def3a
to
5d7ee86
Compare
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
Changelog Entry Suggestion (for CHANGELOG.md):
📚 Documentation preview 📚: https://pytorch-lightning--20896.org.readthedocs.build/en/20896/