def optimizers(self, use_pl_optimizer: bool = True) -> MODULE_OPTIMIZERS:
        """Returns the optimizer(s) that are being used during training. Useful for manual optimization.

        Args:
            use_pl_optimizer: If ``True``, will wrap the optimizer(s) in a
                :class:`~lightning.pytorch.core.optimizer.LightningOptimizer` for automatic handling of precision,
                profiling, and counting of step calls for proper logging and checkpointing. It specifically wraps the
                ``step`` method and custom optimizers that don't have this method are not supported.

        Returns:
            A single optimizer, or a list of optimizers in case multiple ones are present.

        """
        if self._fabric:
            opts: MODULE_OPTIMIZERS = self._fabric_optimizers
        elif use_pl_optimizer:
            opts = self.trainer.strategy._lightning_optimizers
        else:
            opts = self.trainer.optimizers

        # single optimizer
        if (
            isinstance(opts, list)
            and len(opts) == 1
            and isinstance(opts[0], (Optimizer, LightningOptimizer, _FabricOptimizer))
        ):
            return opts[0]
        # multiple opts
        return opts
Returns the optimizer(s) that are being used during training. Useful for manual optimization.

        Args:
            use_pl_optimizer: If ``True``, will wrap the optimizer(s) in a
                :class:`~lightning.pytorch.core.optimizer.LightningOptimizer` for automatic handling of precision,
                profiling, and counting of step calls for proper logging and checkpointing. It specifically wraps the
                ``step`` method and custom optimizers that don't have this method are not supported.

        Returns:
            A single optimizer, or a list of optimizers in case multiple ones are present.

        
src/lightning/pytorch/core/module.py