---
title: ModelSummary
description: Generates a summary of all layers in a LightningModule.
canonical: >-
  https://lightning.ai/docs/pytorch/stable/optional-api/api/lightning.pytorch.callbacks.ModelSummary
---
# ModelSummary {#modelsummary}

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

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

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").

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.
    

Example:

```python
>>> from lightning.pytorch import Trainer
>>> from lightning.pytorch.callbacks import ModelSummary
>>> trainer = Trainer(callbacks=[ModelSummary(max_depth=1)])
```

#### `on_fit_start(trainer, pl_module)` {#lightning.pytorch.callbacks.ModelSummary.on_fit_start}

Called when fit begins.

Return type:

[`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")

---

**Navigation**

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