class_docstr: Create a progress bar with `rich text formatting <https://github.com/Textualize/rich>`_.
  
  Install it with pip:
  
  .. code-block:: bash
  
      pip install rich
  
  .. code-block:: python
  
      from lightning.pytorch import Trainer
      from lightning.pytorch.callbacks import RichProgressBar
  
      trainer = Trainer(callbacks=RichProgressBar())
  
  Args:
      refresh_rate: Determines at which rate (in number of batches) the progress bars get updated.
          Set it to ``0`` to disable the display.
      leave: Leaves the finished progress bar in the terminal at the end of the epoch. Default: False
      theme: Contains styles used to stylize the progress bar.
      console_kwargs: Args for constructing a `Console`
  
  Raises:
      ModuleNotFoundError:
          If required `rich` package is not installed on the device.
  
  Note:
      PyCharm users will need to enable “emulate terminal” in output console option in
      run/debug configuration to see styled output.
      Reference: https://rich.readthedocs.io/en/latest/introduction.html#requirements
class_docstr_tok: ["Create","a","progress","bar","with","`","rich","text","formatting","<","https",":","\/\/github.com\/Textualize\/rich",">","`","_",".","Install","it","with","pip",":","..","code-block",":",":","bash","pip","install","rich","..","code-block",":",":","python","from","lightning.pytorch","import","Trainer","from","lightning.pytorch.callbacks","import","RichProgressBar","trainer","=","Trainer","(","callbacks=RichProgressBar","(",")",")","Args",":","refresh_rate",":","Determines","at","which","rate","(","in","number","of","batches",")","the","progress","bars","get","updated",".","Set","it","to","``","0","``","to","disable","the","display",".","leave",":","Leaves","the","finished","progress","bar","in","the","terminal","at","the","end","of","the","epoch",".","Default",":","False","theme",":","Contains","styles","used","to","stylize","the","progress","bar",".","console_kwargs",":","Args","for","constructing","a","`","Console","`","Raises",":","ModuleNotFoundError",":","If","required","`","rich","`","package","is","not","installed","on","the","device",".","Note",":","PyCharm","users","will","need","to","enable","\u201c","emulate","terminal","\u201d","in","output","console","option","in","run\/debug","configuration","to","see","styled","output",".","Reference",":","https",":","\/\/rich.readthedocs.io\/en\/latest\/introduction.html","#","requirements"]
code: def _init_progress(self, trainer: "pl.Trainer") -> None:
      if self.is_enabled and (
          self.progress is None or self._progress_stopped
      ):
          self._reset_progress_bar_ids()
          reconfigure(**self._console_kwargs)
          self._console = get_console()
          self._console.clear_live()
          self._metric_component = MetricsTextColumn(
              trainer,
              self.theme.metrics,
              self.theme.metrics_text_delimiter,
              self.theme.metrics_format,
          )
          self.progress = CustomProgress(
              *self.configure_columns(trainer),
              self._metric_component,
              auto_refresh=False,
              disable=self.is_disabled,
              console=self._console,
          )
          self.progress.start()
          # progress has started
          self._progress_stopped = False
  
imports: import math
  from dataclasses import dataclass
  from datetime import timedelta
  from typing import Any, Dict, Generator, Optional, Union, cast
  from lightning_utilities.core.imports import RequirementCache
  from typing_extensions import override
  import lightning.pytorch
  from lightning.pytorch.callbacks.progress.progress_bar import ProgressBar
  from lightning.pytorch.utilities.types import STEP_OUTPUT
label_desc: Use image node_id 12 for calling the RichProgressBar obj's underlying member method code with example usage: obj._init_progress(trainer) without return types