Skip to content

Commit d5a15c5

Browse files
committed
rev
1 parent 76d8310 commit d5a15c5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,14 @@ def _init_progress(self, trainer: "pl.Trainer") -> None:
333333
self._console = get_console()
334334

335335
# Compatibility shim for Rich >= 14.1.0:
336-
# In recent Rich releases, the internal `_live` variable was replaced with `_live_stack` (a list)
337-
# to support nested Live displays. This broke our original call to `clear_live()`,
338-
# because it now only pops one Live instance instead of clearing them all.
339-
# We check for `_live_stack` and clear it manually for compatibility across
340-
# both old and new Rich versions.
341-
if hasattr(self._console, "_live_stack") and len(self._console._live_stack) > 0:
342-
self._console.clear_live()
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()
343344
else:
344345
self._console.clear_live()
345346

0 commit comments

Comments
 (0)