mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-26 18:24:18 +00:00
calculate RTF
This commit is contained in:
parent
92ab73e25e
commit
b6216cd51d
@ -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")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user