bezzam HF Staff commited on
Commit
557f20f
·
verified ·
1 Parent(s): ac27dc1

Update run_eval_long.py

Browse files
Files changed (1) hide show
  1. run_eval_long.py +5 -4
run_eval_long.py CHANGED
@@ -78,7 +78,7 @@ def main(args):
78
  durations.append(len(audio_array) / sample_rate)
79
 
80
 
81
- batch["references"] = batch["norm_text"]
82
  batch["audio_filepaths"] = audio_paths
83
  batch["durations"] = durations
84
 
@@ -139,10 +139,9 @@ def main(args):
139
  total_time += end_time - start_time
140
  total_time = total_time
141
 
142
- # normalize transcriptions with English normalizer
143
  if isinstance(transcriptions, tuple) and len(transcriptions) == 2:
144
  transcriptions = transcriptions[0]
145
- predictions = [data_utils.normalizer(pred.text) for pred in transcriptions]
146
 
147
  avg_time = total_time / len(all_data["audio_filepaths"])
148
 
@@ -160,7 +159,9 @@ def main(args):
160
 
161
  print("Results saved at path:", os.path.abspath(manifest_path))
162
 
163
- wer = wer_metric.compute(references=all_data['references'], predictions=predictions)
 
 
164
  wer = round(100 * wer, 2)
165
 
166
  # transcription_time = sum(all_results["transcription_time"])
 
78
  durations.append(len(audio_array) / sample_rate)
79
 
80
 
81
+ batch["references"] = batch["original_text"] # raw; normalization applied at scoring time
82
  batch["audio_filepaths"] = audio_paths
83
  batch["durations"] = durations
84
 
 
139
  total_time += end_time - start_time
140
  total_time = total_time
141
 
 
142
  if isinstance(transcriptions, tuple) and len(transcriptions) == 2:
143
  transcriptions = transcriptions[0]
144
+ predictions = [pred.text for pred in transcriptions] # raw; normalization applied at scoring time
145
 
146
  avg_time = total_time / len(all_data["audio_filepaths"])
147
 
 
159
 
160
  print("Results saved at path:", os.path.abspath(manifest_path))
161
 
162
+ norm_refs = [data_utils.normalizer(r) for r in all_data['references']]
163
+ norm_preds = [data_utils.normalizer(p) for p in predictions]
164
+ wer = wer_metric.compute(references=norm_refs, predictions=norm_preds)
165
  wer = round(100 * wer, 2)
166
 
167
  # transcription_time = sum(all_results["transcription_time"])