fix executor

This commit is contained in:
Yuekai Zhang 2024-01-23 17:40:15 +08:00
parent e46e9b77ee
commit f66b266aa4

View File

@ -33,7 +33,7 @@ from lhotse import (
set_caching_enabled,
)
from icefall.utils import str2bool
from icefall.utils import str2bool, get_executor
# Torch's multithreaded behavior needs to be disabled or
# it wastes a lot of CPU and slow things down.
# Do this outside of main() in case it needs to take effect
@ -137,6 +137,7 @@ def compute_fbank_wenetspeech_splits(args):
set_audio_duration_mismatch_tolerance(0.01) # 10ms tolerance
set_caching_enabled(False)
with get_executor() as ex: # Initialize the executor only once.
for i in range(start, stop):
idx = f"{i + 1}".zfill(num_digits)
logging.info(f"Processing {idx}/{num_splits}")
@ -169,7 +170,7 @@ def compute_fbank_wenetspeech_splits(args):
extractor=extractor,
storage_path=f"{output_dir}/feats_{subset}_{idx}",
num_jobs=args.num_workers,
executor=extractor,
executor=ex,
storage_type=LilcomChunkyWriter,
)
logging.info(f"Saving to {cuts_path}")