docstr: Gets called at the beginning of each epoch
docstr_tok: ["Gets","called","at","the","beginning","of","each","epoch"]
code: def on_stage_start(self, stage, epoch=None):
      """Gets called at the beginning of each epoch"""
      if stage != sb.Stage.TRAIN:
          # Define function taking (prediction, target) for parallel eval
          def pesq_eval(pred_wav, target_wav):
              """Computes the PESQ evaluation metric"""
              psq_mode = (
                  "wb" if self.hparams.sample_rate == 16000 else "nb"
              )
              try:
                  return pesq(
                      fs=self.hparams.sample_rate,
                      ref=target_wav.numpy(),
                      deg=pred_wav.numpy(),
                      mode=psq_mode,
                  )
              except Exception:
                  print("pesq encountered an error for this data item")
                  return 0
  
          self.pesq_metric = MetricStats(
              metric=pesq_eval, n_jobs=1, batch_eval=False
          )
  
imports: import os
  import sys
  import torch
  import torch.nn.functional
  import torchaudio
  import speechbrain
  import speechbrain.nnet.schedulers
  from speechbrain.utils.distributed import run_on_main
  from hyperpyyaml import load_hyperpyyaml
  import numpy
  from tqdm import tqdm
  import csv
  import logging
  from speechbrain.processing.features import spectral_magnitude
  from speechbrain.utils.metric_stats import MetricStats
  from pesq import pesq
  from speechbrain.core import AMPConfig
label_desc: Use image node_id 6 for calling the Separation obj's underlying member method code with example usage: obj.on_stage_start(stage, epoch) and returns: pesq, int