docstr: Gets called when a stage (either training, validation, test) ends.
code: def on_stage_end(self, stage, stage_loss, epoch=None):
      "Gets called when a stage (either training, validation, test) ends."
      if stage == sb.Stage.TRAIN:
          self.train_loss = stage_loss
      if stage == sb.Stage.VALID and epoch is not None:
          print("Epoch %d complete" % epoch)
          print("Train loss: %.2f" % self.train_loss)
      if stage != sb.Stage.TRAIN:
          print(stage, "loss: %.2f" % stage_loss)
          print(
              stage,
              "PER: %.2f" % self.per_metrics.summarize("error_rate"),
          )
  
file_path: speechbrain/tests/integration/G2P/example_g2p.py
imports: import pathlib
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
label_desc: Use image node_id 4 for calling the seq2seqBrain obj's underlying member method code with example usage: obj.on_stage_end(stage, stage_loss, epoch) without return types