docstr: Write wavs to files, for historical discriminator training
  
  Arguments
  ---------
  batch_id : list of str
      A list of the utterance ids for the batch
  wavs : torch.Tensor
      The wavs to write to files
  clean_paths : list of str
      The paths to the clean wavs
  scores : torch.Tensor
      The actual scores for the corresponding utterances
  lens : torch.Tensor
      The relative lengths of each utterance
docstr_tok: ["Write","wavs","to","files",",","for","historical","discriminator","training","Arguments","--","--","--","--","-","batch_id",":","list","of","str","A","list","of","the","utterance","ids","for","the","batch","wavs",":","torch.Tensor","The","wavs","to","write","to","files","clean_paths",":","list","of","str","The","paths","to","the","clean","wavs","scores",":","torch.Tensor","The","actual","scores","for","the","corresponding","utterances","lens",":","torch.Tensor","The","relative","lengths","of","each","utterance"]
code: def write_wavs(self, batch_id, wavs, clean_paths, scores, lens):
      """Write wavs to files, for historical discriminator training
  
      Arguments
      ---------
      batch_id : list of str
          A list of the utterance ids for the batch
      wavs : torch.Tensor
          The wavs to write to files
      clean_paths : list of str
          The paths to the clean wavs
      scores : torch.Tensor
          The actual scores for the corresponding utterances
      lens : torch.Tensor
          The relative lengths of each utterance
      """
      lens = lens * wavs.shape[1]
      record = {}
      for i, (name, pred_wav, clean_path, length) in enumerate(
          zip(batch_id, wavs, clean_paths, lens)
      ):
          path = os.path.join(
              self.hparams.MetricGAN_folder, name + ".wav"
          )
          data = torch.unsqueeze(pred_wav[: int(length)].cpu(), 0)
          torchaudio.save(path, data, self.hparams.Sample_rate)
  
          # Make record of path and score for historical training
          score = float(scores[i][0])
          record[name] = {
              "enh_wav": path,
              "score": score,
              "clean_wav": clean_path,
          }
  
      # Update records for historical training
      self.historical_set.update(record)
  
      with open(self.hparams.historical_file, "wb") as fp:  # Pickling
          pickle.dump(self.historical_set, fp)
  
imports: import os
  import sys
  import shutil
  import pickle
  import torch
  import torchaudio
  import speechbrain
  from pesq import pesq
  from enum import Enum, auto
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.metric_stats import MetricStats
  from speechbrain.processing.features import spectral_magnitude
  from speechbrain.nnet.loss.stoi_loss import stoi_loss
  from speechbrain.utils.distributed import run_on_main
  from speechbrain.dataio.sampler import ReproducibleWeightedRandomSampler
label_desc: Use image node_id 9 for calling the MetricGanBrain obj's underlying member method code with example usage: obj.write_wavs(batch_id, wavs, clean_paths, scores, lens) without return types