class_docstr: Generates a summary of all layers in a :class:`~lightning.pytorch.core.LightningModule` 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 RichModelSummary
  
      trainer = Trainer(callbacks=RichModelSummary())
  
  You could also enable ``RichModelSummary`` using the :class:`~lightning.pytorch.callbacks.RichProgressBar`
  
  .. code-block:: python
  
      from lightning.pytorch import Trainer
      from lightning.pytorch.callbacks import RichProgressBar
  
      trainer = Trainer(callbacks=RichProgressBar())
  
  Args:
      max_depth: The maximum depth of layer nesting that the summary will include. A value of 0 turns the
          layer summary off.
      **summarize_kwargs: Additional arguments to pass to the `summarize` method.
  
  Raises:
      ModuleNotFoundError:
          If required `rich` package is not installed on the device.
code: def summarize(
      summary_data: List[Tuple[str, List[str]]],
      total_parameters: int,
      trainable_parameters: int,
      model_size: float,
      **summarize_kwargs: Any,
  ) -> None:
      from rich import get_console
      from rich.table import Table
  
      console = get_console()
  
      header_style: str = summarize_kwargs.get(
          "header_style", "bold magenta"
      )
      table = Table(header_style=header_style)
      table.add_column(" ", style="dim")
      table.add_column("Name", justify="left", no_wrap=True)
      table.add_column("Type")
      table.add_column("Params", justify="right")
  
      column_names = list(zip(*summary_data))[0]
  
      for column_name in ["In sizes", "Out sizes"]:
          if column_name in column_names:
              table.add_column(
                  column_name, justify="right", style="white"
              )
  
      rows = list(zip(*(arr[1] for arr in summary_data)))
      for row in rows:
          table.add_row(*row)
  
      console.print(table)
  
      parameters = []
      for param in [
          trainable_parameters,
          total_parameters - trainable_parameters,
          total_parameters,
          model_size,
      ]:
          parameters.append(
              "{:<{}}".format(get_human_readable_count(int(param)), 10)
          )
  
      grid = Table.grid(expand=True)
      grid.add_column()
      grid.add_column()
  
      grid.add_row(f"[bold]Trainable params[/]: {parameters[0]}")
      grid.add_row(f"[bold]Non-trainable params[/]: {parameters[1]}")
      grid.add_row(f"[bold]Total params[/]: {parameters[2]}")
      grid.add_row(
          f"[bold]Total estimated model params size (MB)[/]: {parameters[3]}"
      )
  
      console.print(grid)
  
file_path: pytorch-lightning/src/lightning/pytorch/callbacks/rich_model_summary.py
imports: from typing import Any, List, Tuple
  from typing_extensions import override
  from lightning.pytorch.callbacks import ModelSummary
  from lightning.pytorch.callbacks.progress.rich_progress import _RICH_AVAILABLE
  from lightning.pytorch.utilities.model_summary import get_human_readable_count
label_desc: Use image node_id 2 for calling the RichModelSummary obj's underlying member method code with example usage: obj.summarize(summary_data, total_parameters, trainable_parameters, model_size) without return types