code: def _clear_schedulers(trainer: "pl.Trainer") -> None:
      # If we have scheduler state saved, clear the scheduler configs so that we don't try to
      # load state into the wrong type of schedulers when restoring scheduler checkpoint state.
      # We'll configure the scheduler and re-load its state in on_train_epoch_start.
      # Note that this relies on the callback state being restored before the scheduler state is
      # restored, and doesn't work if restore_checkpoint_after_setup is True, but at the time of
      # writing that is only True for deepspeed which is already not supported by SWA.
      # See https://github.com/Lightning-AI/lightning/issues/11665 for background.
      if trainer.lr_scheduler_configs:
          assert len(trainer.lr_scheduler_configs) == 1
          trainer.lr_scheduler_configs.clear()
  
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 17 for calling the StochasticWeightAveraging obj's underlying member method code with example usage: obj._clear_schedulers(trainer) without return types