Skip to content

Commit b2e8ab5

Browse files
author
sanchit-gandhi
committed
small changes
1 parent 7444696 commit b2e8ab5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

transformers/run_eval.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def benchmark(batch):
4545
start_time = time.time()
4646
result = asr_pipe(batch["audio"], generate_kwargs=gen_kwargs)
4747
# normalize by minibatch size since we want the per-sample time
48-
runtime = (time.time() - start_time) / minibatch_size
49-
batch["transcription_time"] = [runtime for _ in range(minibatch_size)]
48+
batch["transcription_time"] = minibatch_size * [(time.time() - start_time) / minibatch_size]
5049

5150
# normalize transcriptions with English normalizer
5251
batch["predictions"] = [data_utils.normalizer(pred["text"]) for pred in result]
@@ -68,7 +67,7 @@ def benchmark(batch):
6867
for key in all_results:
6968
all_results[key].append(result[key])
7069

71-
# Write manifest results
70+
# Write manifest results (WER and RTFX)
7271
manifest_path = data_utils.write_manifest(
7372
all_results["references"],
7473
all_results["predictions"],
@@ -90,7 +89,7 @@ def benchmark(batch):
9089
transcription_time = sum(all_results["transcription_time"])
9190
audio_length = sum(all_results["audio_length"])
9291
rtfx = audio_length / transcription_time
93-
rtfx = round(rtfx, 4)
92+
rtfx = round(rtfx, 2)
9493
print("RTFX:", rtfx)
9594

9695

0 commit comments

Comments
 (0)