Skip to content

Commit 3f2f230

Browse files
authored
Merge branch 'master' into dependabot-github_actions-Lightning-AI-utilities-0.15.0
2 parents ceaa4ff + 9e6b3d6 commit 3f2f230

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

requirements/pytorch/extra.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ matplotlib>3.1, <3.10.0
66
omegaconf >=2.2.3, <2.4.0
77
hydra-core >=1.2.0, <1.4.0
88
jsonargparse[signatures,jsonnet] >=4.39.0, <4.41.0
9-
rich >=12.3.0, <14.1.0
9+
rich >=12.3.0, <14.2.0
1010
tensorboardX >=2.2, <2.7.0 # min version is set by torch.onnx missing attribute
1111
bitsandbytes >=0.45.2,<0.47.0; platform_system != "Darwin"

src/lightning/pytorch/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2525

2626
### Fixed
2727

28-
-
28+
- fix progress bar console clearing for Rich `14.1+` ([#21016](https://github.com/Lightning-AI/pytorch-lightning/pull/21016))
2929

3030

3131
---

src/lightning/pytorch/callbacks/progress/rich_progress.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,19 @@ def _init_progress(self, trainer: "pl.Trainer") -> None:
331331
self._reset_progress_bar_ids()
332332
reconfigure(**self._console_kwargs)
333333
self._console = get_console()
334-
self._console.clear_live()
334+
335+
# Compatibility shim for Rich >= 14.1.0:
336+
if hasattr(self._console, "_live_stack"):
337+
# In recent Rich releases, the internal `_live` variable was replaced with `_live_stack` (a list)
338+
# to support nested Live displays. This broke our original call to `clear_live()`,
339+
# because it now only pops one Live instance instead of clearing them all.
340+
# We check for `_live_stack` and clear it manually for compatibility across
341+
# both old and new Rich versions.
342+
if len(self._console._live_stack) > 0:
343+
self._console.clear_live()
344+
else:
345+
self._console.clear_live()
346+
335347
self._metric_component = MetricsTextColumn(
336348
trainer,
337349
self.theme.metrics,

0 commit comments

Comments
 (0)