docstr: Save samples and BLEU score from last batch for current epoch.
  Arguments
  ---------
  epoch : int
      The currently-starting epoch. This is passed
      `None` during the test stage.
docstr_tok: ["Save","samples","and","BLEU","score","from","last","batch","for","current","epoch",".","Arguments","--","--","--","--","-","epoch",":","int","The","currently-starting","epoch",".","This","is","passed","`","None","`","during","the","test","stage","."]
code: def _save_progress_sample(self, epoch):
      """Save samples and BLEU score from last batch for current epoch.
      Arguments
      ---------
      epoch : int
          The currently-starting epoch. This is passed
          `None` during the test stage.
      """
      if self.last_batch is None:
          return
  
      (
          ids,
          (wavs, transcripts),
          (tgt_transcripts, tgt_wavs),
      ) = self.last_batch
  
      save_folder = (
          pl.Path(self.hparams.progress_sample_path) / f"{epoch}"
      )
      save_folder.mkdir(parents=True, exist_ok=True)
  
      sample_size = self.hparams.progress_batch_sample_size
      if len(ids) < sample_size:
          sample_size = len(ids)
  
      for i in tqdm.tqdm(range(sample_size)):
          utt_id = ids[i]
          wav = wavs[i]
          transcript = transcripts[i]
          tgt_transcript = tgt_transcripts[i]
          tgt_wav = tgt_wavs[i]
  
          sample_path = save_folder / f"{utt_id}_pred.wav"
          sb.dataio.dataio.write_audio(
              sample_path, wav, self.hparams.sample_rate
          )
  
          sample_path = save_folder / f"{utt_id}_ref.wav"
          sb.dataio.dataio.write_audio(
              sample_path, tgt_wav, self.hparams.sample_rate
          )
  
          sample_path = save_folder / f"{utt_id}.txt"
          with open(sample_path, "w") as file:
              file.write(f"pred: {transcript}\n")
              file.write(f"ref: {tgt_transcript}\n")
  
      self.bleu_metric.append(
          ids[:sample_size],
          transcripts[:sample_size],
          [tgt_transcripts[:sample_size]],
      )
  
      bleu_path = save_folder / "bleu.txt"
      with open(bleu_path, "w") as file:
          file.write(
              f"BLEU score: {round(self.bleu_metric.summarize('BLEU'), 2)}\n"
          )
  
imports: import sys
  import torch
  import logging
  import pathlib
  from hyperpyyaml import load_hyperpyyaml
  import speechbrain
  from speechbrain.inference.vocoders import UnitHIFIGAN
  from speechbrain.inference.ASR import EncoderDecoderASR
  import tqdm
  import torchaudio
  import numpy
  from torch.nn.parallel import DistributedDataParallel
label_desc: Use image node_id 9 for calling the S2UT obj's underlying member method code with example usage: obj._save_progress_sample(epoch) without return types