class_docstr: LR finder object. This object stores the results of lr_find().
  
  Args:
      mode: either `linear` or `exponential`, how to increase lr after each step
  
      lr_min: lr to start search from
  
      lr_max: lr to stop search
  
      num_training: number of steps to take between lr_min and lr_max
  
  Example::
      # Run lr finder
      lr_finder = trainer.lr_find(model)
  
      # Results stored in
      lr_finder.results
  
      # Plot using
      lr_finder.plot()
  
      # Get suggestion
      lr = lr_finder.suggestion()
docstr: Decorate `trainer.strategy.setup_optimizers` method such that it sets the user's originally specified
  optimizer together with a new scheduler that takes care of the learning rate search.
docstr_tok: ["Decorate","`","trainer.strategy.setup_optimizers","`","method","such","that","it","sets","the","user","'s","originally","specified","optimizer","together","with","a","new","scheduler","that","takes","care","of","the","learning","rate","search","."]
code: def _exchange_scheduler(self, trainer: "pl.Trainer") -> None:
      # TODO: update docs here
      """Decorate `trainer.strategy.setup_optimizers` method such that it sets the user's originally specified
      optimizer together with a new scheduler that takes care of the learning rate search.
      """
      from lightning.pytorch.core.optimizer import (
          _validate_optimizers_attached,
      )
  
      optimizers = trainer.strategy.optimizers
  
      if len(optimizers) != 1:
          raise MisconfigurationException(
              f"`model.configure_optimizers()` returned {len(optimizers)}, but"
              " learning rate finder only works with single optimizer"
          )
  
      optimizer = optimizers[0]
  
      new_lrs = [self.lr_min] * len(optimizer.param_groups)
      for param_group, new_lr in zip(optimizer.param_groups, new_lrs):
          param_group["lr"] = new_lr
          param_group["initial_lr"] = new_lr
  
      args = (optimizer, self.lr_max, self.num_training)
      scheduler = (
          _LinearLR(*args)
          if self.mode == "linear"
          else _ExponentialLR(*args)
      )
      scheduler = cast(LRScheduler, scheduler)
  
      trainer.strategy.optimizers = [optimizer]
      trainer.strategy.lr_scheduler_configs = [
          LRSchedulerConfig(scheduler, interval="step")
      ]
      _validate_optimizers_attached(
          trainer.optimizers, trainer.lr_scheduler_configs
      )
  
imports: import importlib
  import logging
  import os
  import uuid
  from copy import deepcopy
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union, cast
  import torch
  from lightning_utilities.core.imports import RequirementCache
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.utilities.types import _TORCH_LRSCHEDULER
  from lightning.pytorch.callbacks import Callback
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.parsing import lightning_hasattr, lightning_setattr
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
  from lightning.pytorch.utilities.types import STEP_OUTPUT, LRScheduler, LRSchedulerConfig
label_desc: Use image node_id 2 for calling the _LRFinder obj's underlying member method code with example usage: obj._exchange_scheduler(trainer) without return types