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 argparse
import logging import logging
import math import math
import time
from typing import List from typing import List
import k2 import k2
@ -314,6 +315,8 @@ def main():
waves = [w.to(device) for w in waves] waves = [w.to(device) for w in waves]
logging.info("Decoding started") logging.info("Decoding started")
start_time = time.time()
features = fbank(waves) features = fbank(waves)
feature_lengths = [f.size(0) for f in features] feature_lengths = [f.size(0) for f in features]
@ -366,12 +369,17 @@ def main():
hyps.append(token_ids_to_words(hyp)) hyps.append(token_ids_to_words(hyp))
else: else:
raise ValueError(f"Unsupported method: {params.method}") 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" s = "\n"
for filename, hyp in zip(params.sound_files, hyps): for filename, hyp in zip(params.sound_files, hyps):
s += f"{filename}:\n{hyp}\n\n" s += f"{filename}:\n{hyp}\n\n"
logging.info(s) logging.info(s)
logging.info("Decoding Done") logging.info("Decoding Done")