class_docstr: Class for speaker embedding training
docstr: Gets called at the end of an epoch.
docstr_tok: ["Gets","called","at","the","end","of","an","epoch","."]
code: def on_stage_end(self, stage, stage_loss, epoch=None):
      """Gets called at the end of an epoch."""
      # Compute/store important stats
      stage_stats = {"loss": stage_loss}
      if stage == sb.Stage.TRAIN:
          self.train_stats = stage_stats
      else:
          stage_stats["ErrorRate"] = self.error_metrics.summarize(
              "average"
          )
  
      # Perform end-of-iteration things, like annealing, logging, etc.
      if stage == sb.Stage.VALID:
          old_lr, new_lr = self.hparams.lr_annealing(epoch)
          sb.nnet.schedulers.update_learning_rate(
              self.optimizer, new_lr
          )
  
          self.hparams.train_logger.log_stats(
              stats_meta={"epoch": epoch, "lr": old_lr},
              train_stats=self.train_stats,
              valid_stats=stage_stats,
          )
          self.checkpointer.save_and_keep_only(
              meta={"ErrorRate": stage_stats["ErrorRate"]},
              min_keys=["ErrorRate"],
          )
  
file_path: speechbrain/recipes/VoxCeleb/SpeakerRec/train_speaker_embeddings.py
imports: import os
  import sys
  import random
  import torch
  import torchaudio
  import speechbrain
  from speechbrain.utils.data_utils import download_file
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 4 for calling the SpeakerBrain obj's underlying member method code with example usage: obj.on_stage_end(stage, stage_loss, epoch) without return types