class_docstr: Class that manages the training loop. See speechbrain.core.Brain.
class_docstr_tok: ["Class","that","manages","the","training","loop",".","See","speechbrain.core.Brain","."]
docstr: Gets called at the beginning of each epoch.
  
  Arguments
  ---------
  stage : sb.Stage
      One of sb.Stage.TRAIN, sb.Stage.VALID, or sb.Stage.TEST.
  epoch : int
      The currently-starting epoch. This is passed
      `None` during the test stage.
docstr_tok: ["Gets","called","at","the","beginning","of","each","epoch",".","Arguments","--","--","--","--","-","stage",":","sb.Stage","One","of","sb.Stage.TRAIN",",","sb.Stage.VALID",",","or","sb.Stage.TEST",".","epoch",":","int","The","currently-starting","epoch",".","This","is","passed","`","None","`","during","the","test","stage","."]
code: def on_stage_start(self, stage, epoch=None):
      """Gets called at the beginning of each epoch.
  
      Arguments
      ---------
      stage : sb.Stage
          One of sb.Stage.TRAIN, sb.Stage.VALID, or sb.Stage.TEST.
      epoch : int
          The currently-starting epoch. This is passed
          `None` during the test stage.
      """
  
      # Set up statistics trackers for this stage
      self.loss_metric = sb.utils.metric_stats.MetricStats(
          metric=sb.nnet.losses.nll_loss
      )
  
      # Set up evaluation-only statistics trackers
      if stage != sb.Stage.TRAIN:
          self.error_metrics = self.hparams.error_stats()
  
file_path: speechbrain/templates/speaker_id/train.py
imports: import os
  import sys
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
  from mini_librispeech_prepare import prepare_mini_librispeech
label_desc: Use image node_id 4 for calling the SpkIdBrain obj's underlying member method code with example usage: obj.on_stage_start(stage, epoch) without return types