---
title: RichModelSummary
description: |-
  Generates a summary of all layers in a LightningModule with rich text
  formatting.
canonical: >-
  https://lightning.ai/docs/pytorch/stable/optional-api/api/lightning.pytorch.callbacks.RichModelSummary
---
# RichModelSummary {#richmodelsummary}

### `class lightning.pytorch.callbacks.RichModelSummary(max_depth=1, **summarize_kwargs)` {#lightning.pytorch.callbacks.RichModelSummary}

Bases: [`ModelSummary`](/docs/pytorch/2.6.6/optional-api/api/lightning.pytorch.callbacks.ModelSummary.md#lightning.pytorch.callbacks.ModelSummary "lightning.pytorch.callbacks.model_summary.ModelSummary")

Generates a summary of all layers in a [`LightningModule`](/docs/pytorch/2.6.6/optional-api/api/lightning.pytorch.core.LightningModule.md#lightning.pytorch.core.LightningModule "lightning.pytorch.core.LightningModule") with [rich text formatting](https://github.com/Textualize/rich).

Install it with pip:

```bash
pip install rich
```

```python
from lightning.pytorch import Trainer
from lightning.pytorch.callbacks import RichModelSummary

trainer = Trainer(callbacks=RichModelSummary())
```

You could also enable `RichModelSummary` using the [`RichProgressBar`](/docs/pytorch/2.6.6/optional-api/api/lightning.pytorch.callbacks.RichProgressBar.md#lightning.pytorch.callbacks.RichProgressBar "lightning.pytorch.callbacks.RichProgressBar")

```python
from lightning.pytorch import Trainer
from lightning.pytorch.callbacks import RichProgressBar

trainer = Trainer(callbacks=RichProgressBar())
```

Parameters:

*   **max\_depth** ([`int`](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)")) – The maximum depth of layer nesting that the summary will include. A value of 0 turns the layer summary off.
    
*   **\*\*summarize\_kwargs** ([`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")) – Additional arguments to pass to the summarize method.
    

Raises:

[**ModuleNotFoundError**](https://docs.python.org/3/builtins/exceptions.html#ModuleNotFoundError "(in Python v3.15)") – If required rich package is not installed on the device.

---

**Navigation**

- Parent: [Api](/docs/pytorch/2.6.6/optional-api/api.md)
