code: def main():
      """Run pseudo MOS calculation in parallel."""
      args = get_parser().parse_args()
  
      # logging info
      if args.verbose > 1:
          logging.basicConfig(
              level=logging.DEBUG,
              format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(message)s",
          )
      elif args.verbose > 0:
          logging.basicConfig(
              level=logging.INFO,
              format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(message)s",
          )
      else:
          logging.basicConfig(
              level=logging.WARN,
              format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(message)s",
          )
          logging.warning("Skip DEBUG/INFO messages")
  
      # Find files for generated speech waveforms.
      if os.path.isdir(args.gen_wavdir_or_wavscp):
          gen_files = sorted(find_files(args.gen_wavdir_or_wavscp))
      else:
          with open(args.gen_wavdir_or_wavscp) as f:
              gen_files = [
                  line.strip().split(None, 1)[1]
                  for line in f.readlines()
              ]
          if gen_files[0].endswith("|"):
              raise ValueError("Not supported wav.scp format.")
  
      # Get and divide list
      if len(gen_files) == 0:
          raise FileNotFoundError(
              "Not found any generated audio files."
          )
      logging.info("The number of utterances = %d" % len(gen_files))
  
      if torch.cuda.is_available() and ("cuda" in args.device):
          device = torch.device(args.device)
      else:
          device = torch.device("cpu")
  
      if args.mos_toolkit == "utmos":
          # Load predictor for UTMOS22.
          predictor = torch.hub.load(
              "tarepan/SpeechMOS:v1.2.0", "utmos22_strong"
          ).to(device)
      else:
          raise NotImplementedError(
              f"Not supported {args.mos_toolkit}."
          )
  
      # Calculate pseudo MOS for all the files.
      pmos_dict = calculate(
          gen_files, predictor, device, args.batchsize
      )
  
      # convert to standard list
      pmos_dict = dict(pmos_dict)
  
      # calculate statistics
      mean_pmos = np.mean(np.array([v for v in pmos_dict.values()]))
      std_pmos = np.std(np.array([v for v in pmos_dict.values()]))
      logging.info(f"Average: {mean_pmos:.4f} ± {std_pmos:.4f}")
  
      # Write results
      if args.outdir is None:
          if os.path.isdir(args.gen_wavdir_or_wavscp):
              args.outdir = args.gen_wavdir_or_wavscp
          else:
              args.outdir = os.path.dirname(args.gen_wavdir_or_wavscp)
      os.makedirs(args.outdir, exist_ok=True)
      with open(f"{args.outdir}/utt2pmos", "w") as f:
          for utt_id in sorted(pmos_dict.keys()):
              pmos = pmos_dict[utt_id]
              f.write(f"{utt_id} {pmos:.4f}\n")
      with open(f"{args.outdir}/pmos_avg_result.txt", "w") as f:
          f.write(f"#utterances: {len(gen_files)}\n")
          f.write(f"Average: {mean_pmos:.4f} ± {std_pmos:.4f}")
  
      logging.info("Successfully finished pseudo MOS evaluation.")
  
file_path: espnet/egs2/wham/enh1/pyscripts/utils/evaluate_pseudomos.py
imports: import argparse
  import fnmatch
  import logging
  import os
  from typing import List
  import librosa
  import numpy
  import torch
label_desc: Use image node_id 5 for calling a global function with example usage: main() without return types