code: def main(args):
      # LOAD DATASET
      enh = []
      with open(args.predicted_path, "r") as f:
          for line in f.readlines():
              enh.append(line.split())
      ref = []
      with open(args.target_path, "r") as f:
          for line in f.readlines():
              ref.append(line.split())
  
      print("COMPUTING TASK 1 METRICS")
      print("M: Final Task 1 metric")
      print("W: Word Error Rate")
      print("S: Stoi")
  
      WER = 0.0
      STOI = 0.0
      METRIC = 0.0
      count = 0
      with tqdm(total=len(ref)) as pbar:
          for example_num, (key, ref_wav) in enumerate(ref):
              assert key == enh[example_num][0]
              target, sr = torchaudio.load(ref_wav)
              outputs, sr = torchaudio.load(enh[example_num][1])
              metric, wer, stoi = task1_metric(
                  target.squeeze(0), outputs.squeeze(0), sr
              )
              if metric is not None:
                  METRIC += (1.0 / float(example_num + 1)) * (
                      metric - METRIC
                  )
                  WER += (1.0 / float(example_num + 1)) * (wer - WER)
                  STOI += (1.0 / float(example_num + 1)) * (stoi - STOI)
              else:
                  print("No voice activity on this frame")
              pbar.set_description(
                  "M:"
                  + str(np.round(METRIC, decimals=3))
                  + ", W:"
                  + str(np.round(WER, decimals=3))
                  + ", S: "
                  + str(np.round(STOI, decimals=3))
              )
              pbar.update(1)
              count += 1
  
      # print the results
      results = {
          "word error rate": WER,
          "stoi": STOI,
          "task 1 metric": METRIC,
      }
      print("*******************************")
      print("RESULTS")
      for i in results:
          print(i, results[i])
  
file_path: espnet/egs2/l3das22/enh1/local/metric.py
imports: import argparse
  import os
  import sys
  import warnings
  import jiwer
  import numpy
  import soundfile
  import torch
  import torchaudio
  import transformers
  from pystoi import stoi
  from tqdm import tqdm
  from transformers import Wav2Vec2ForMaskedLM, Wav2Vec2Tokenizer
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types