Skip to content
Merged
14 changes: 13 additions & 1 deletion src/lightning/pytorch/callbacks/progress/rich_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,19 @@ def _init_progress(self, trainer: "pl.Trainer") -> None:
self._reset_progress_bar_ids()
reconfigure(**self._console_kwargs)
self._console = get_console()
self._console.clear_live()

# Compatibility shim for Rich >= 14.1.0:
# In recent Rich releases, the internal `_live` variable was replaced with `_live_stack` (a list)
# to support nested Live displays. This broke our original call to `clear_live()`,
# because it now only pops one Live instance instead of clearing them all.
# We check for `_live_stack` and clear it manually for compatibility across
# both old and new Rich versions.
if hasattr(self._console, "_live_stack"):
if len(self._console._live_stack) > 0:
self._console.clear_live()
else:
self._console.clear_live()

self._metric_component = MetricsTextColumn(
trainer,
self.theme.metrics,
Expand Down
Loading