code: def lr_find(
      self: Learner,
      start_lr=1e-7,
      end_lr=10,
      num_it=100,
      stop_div=True,
      show_plot=True,
      suggest_funcs=(SuggestionMethod.Valley),
  ):
      "Launch a mock training to find a good learning rate and return suggestions based on `suggest_funcs` as a named tuple"
      n_epoch = num_it // len(self.dls.train) + 1
      cb = LRFinder(
          start_lr=start_lr,
          end_lr=end_lr,
          num_it=num_it,
          stop_div=stop_div,
      )
      with self.no_logging():
          self.fit(n_epoch, cbs=cb)
      if suggest_funcs is not None:
          lrs, losses = tensor(
              self.recorder.lrs[num_it // 10 : -5]
          ), tensor(self.recorder.losses[num_it // 10 : -5])
          nan_idxs = torch.nonzero(torch.isnan(losses.view(-1)))
          if len(nan_idxs) > 0:
              drop_idx = min(nan_idxs)
              lrs = lrs[:drop_idx]
              losses = losses[:drop_idx]
          _suggestions, nms = [], []
          for func in tuplify(suggest_funcs):
              nms.append(
                  func.__name__
                  if not isinstance(func, partial)
                  else func.func.__name__
              )  # deal with partials
              _suggestions.append(func(lrs, losses, num_it))
  
          SuggestedLRs = collections.namedtuple("SuggestedLRs", nms)
          lrs, pnts = [], []
          for lr, pnt in _suggestions:
              lrs.append(lr)
              pnts.append(pnt)
          if show_plot:
              self.recorder.plot_lr_find(suggestions=pnts, nms=nms)
          return SuggestedLRs(*lrs)
  
      elif show_plot:
          self.recorder.plot_lr_find()
  
imports: from __future__ import annotations
  from ..basics import *
  from .tracker import SaveModelCallback
label_desc: Use image node_id 23 for calling a global function with example usage: lr_find(start_lr, end_lr, num_it, stop_div, show_plot, suggest_funcs) and returns: SuggestedLRs