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
  score : 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","score",":","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, score, 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
      score : 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, length) in enumerate(
          zip(batch_id, wavs, 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(score[i][0])
          record[name] = {
              "enh_wav": path,
              "score": score,
          }
  
      # 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 torch
  import torchaudio
  import speechbrain
  import numpy
  import json
  import pickle
  import requests
  import time
  from urllib.parse import urlparse, urljoin
  from srmrpy import srmr
  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, score, lens) without return types