calculate RTF

This commit is contained in:
Triplecq 2024-03-31 19:53:29 -04:00
parent 92ab73e25e
commit b6216cd51d

View File

@ -111,6 +111,7 @@ Note: ./zipformer/exp/pretrained.pt is generated by ./zipformer/export.py
import argparse
import logging
import math
import time
from typing import List
import k2
@ -314,6 +315,8 @@ def main():
waves = [w.to(device) for w in waves]
logging.info("Decoding started")
start_time = time.time()
features = fbank(waves)
feature_lengths = [f.size(0) for f in features]
@ -367,6 +370,11 @@ def main():
else:
raise ValueError(f"Unsupported method: {params.method}")
end_time = time.time()
elapsed_seconds = end_time - start_time
logging.info(f"elapsed seconds:, {elapsed_seconds}")
s = "\n"
for filename, hyp in zip(params.sound_files, hyps):
s += f"{filename}:\n{hyp}\n\n"