def setup(self, trainer: "pl.Trainer") -> None:
        """Sets up the accelerator, plugins and initializes the optimizers (if needed).

        Args:
            trainer: the trainer instance

        """
        assert self.accelerator is not None
        self.accelerator.setup(trainer)

        assert self.model is not None
        # let the precision plugin convert the module here so that this strategy hook can decide the order
        # of operations
        self.model = self.precision_plugin.convert_module(self.model)
        self.model_to_device()
        self.model = self._setup_model(self.model)

        if trainer.state.fn == TrainerFn.FITTING:
            self.setup_optimizers(trainer)
        self.setup_precision_plugin()
        if trainer.state.fn == TrainerFn.FITTING:
            _optimizers_to_device(self.optimizers, self.root_device)
Sets up the accelerator, plugins and initializes the optimizers (if needed).

        Args:
            trainer: the trainer instance

        
src/lightning/pytorch/strategies/strategy.py