code: def on_fit_start(
      self, trainer: "pl.Trainer", pl_module: "pl.LightningModule"
  ) -> None:
      if len(trainer.optimizers) != 1:
          raise MisconfigurationException(
              "SWA currently works with 1 `optimizer`."
          )
  
      if len(trainer.lr_scheduler_configs) > 1:
          raise MisconfigurationException(
              "SWA currently not supported for more than 1 `lr_scheduler`."
          )
  
      assert trainer.max_epochs is not None
      if isinstance(self._swa_epoch_start, float):
          self._swa_epoch_start = int(
              trainer.max_epochs * self._swa_epoch_start
          )
  
      self._model_contains_batch_norm = (
          self.pl_module_contains_batch_norm(pl_module)
      )
  
      self._max_epochs = trainer.max_epochs
      if self._model_contains_batch_norm:
          # virtually increase max_epochs to perform batch norm update on latest epoch.
          assert trainer.fit_loop.max_epochs is not None
          trainer.fit_loop.max_epochs += 1
  
      if self._scheduler_state is not None:
          self._clear_schedulers(trainer)
  
imports: from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Union, cast
  import torch
  from torch import Tensor, nn
  from torch.optim.swa_utils import SWALR
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.utilities.types import LRScheduler
  from lightning.pytorch.callbacks.callback import Callback
  from lightning.pytorch.strategies import DeepSpeedStrategy
  from lightning.pytorch.strategies.fsdp import FSDPStrategy
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.rank_zero import rank_zero_info, rank_zero_warn
  from lightning.pytorch.utilities.types import LRSchedulerConfig
label_desc: Use image node_id 6 for calling the StochasticWeightAveraging obj's underlying member method code with example usage: obj.on_fit_start(trainer, pl_module) without return types