def setup(self, trainer: pl.Trainer, pl_module: pl.LightningModule, stage: str | None = None) -> None:
        """Set Tiler object within Anomalib Model.

        This method is called by PyTorch Lightning during setup. It configures the tiling
        parameters if tiling is enabled and the model supports it.

        Args:
            trainer (pl.Trainer): PyTorch Lightning Trainer instance.
            pl_module (pl.LightningModule): The Anomalib model being trained/tested.
            stage (str | None, optional): Current stage - ``"fit"``, ``"validate"``,
                ``"test"`` or ``"predict"``. Defaults to ``None``.

        Raises:
            ValueError: If tiling is enabled but the model doesn't support tiling operations
                (i.e., doesn't have a ``tiler`` attribute).
        """
        del trainer, stage  # These variables are not used.

        if self.enable:
            if isinstance(pl_module, AnomalibModule) and hasattr(pl_module.model, "tiler"):
                pl_module.model.tiler = Tiler(
                    tile_size=self.tile_size,
                    stride=self.stride,
                    remove_border_count=self.remove_border_count,
                    mode=self.mode,
                )
            else:
                msg = "Model does not support tiling."
                raise ValueError(msg)
Set Tiler object within Anomalib Model.

        This method is called by PyTorch Lightning during setup. It configures the tiling
        parameters if tiling is enabled and the model supports it.

        Args:
            trainer (pl.Trainer): PyTorch Lightning Trainer instance.
            pl_module (pl.LightningModule): The Anomalib model being trained/tested.
            stage (str | None, optional): Current stage - ``"fit"``, ``"validate"``,
                ``"test"`` or ``"predict"``. Defaults to ``None``.

        Raises:
            ValueError: If tiling is enabled but the model doesn't support tiling operations
                (i.e., doesn't have a ``tiler`` attribute).
        
src/anomalib/callbacks/tiler_configuration.py