docstr: At the end of the optimizer step, apply noam annealing and logging.
docstr_tok: ["At","the","end","of","the","optimizer","step",",","apply","noam","annealing","and","logging","."]
code: def on_fit_batch_end(self, batch, outputs, loss, should_step):
      """At the end of the optimizer step, apply noam annealing and logging."""
      if should_step:
          if isinstance(
              self.hparams.lr_annealing,
              sb.nnet.schedulers.NoamScheduler,
          ) or isinstance(
              self.hparams.lr_annealing,
              sb.nnet.schedulers.CyclicCosineScheduler,
          ):
              self.hparams.lr_annealing(self.optimizer)
  
      if isinstance(
          self.hparams.train_logger,
          sb.utils.train_logger.TensorboardLogger,
      ):
          self.hparams.train_logger.log_stats(
              stats_meta={"step": self.step},
              train_stats={"loss": loss},
          )
  
file_path: speechbrain/recipes/KsponSpeech/LM/train.py
imports: import sys
  import logging
  from pathlib import Path
  import torch
  from hyperpyyaml import load_hyperpyyaml
  import speechbrain
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 3 for calling the LM obj's underlying member method code with example usage: obj.on_fit_batch_end(batch, outputs, loss, should_step) without return types