Skip to content

Commit 6919de5

Browse files
committed
fix ci test failures due to rich progress bar
1 parent 5d89996 commit 6919de5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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+
# 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"):
342+
if len(self._console._live_stack) > 0:
343+
self._console._live_stack.clear()
344+
else:
345+
self._console.clear_live()
346+
335347
self._metric_component = MetricsTextColumn(
336348
trainer,
337349
self.theme.metrics,

0 commit comments

Comments
 (0)