Skip to content

Commit

Permalink
提取内容特征改为线程池
Browse files Browse the repository at this point in the history
  • Loading branch information
ZSCharlie committed Jun 9, 2023
1 parent a16c785 commit c9367bb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions prepare/preprocess_ppg.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ def process_file(file):
else:
process_num = args.thread_count

# with ThreadPoolExecutor(max_workers=process_num) as executor:
# futures = [executor.submit(process_file, file) for file in os.listdir(f"./{wavPath}/{spks}")]
# for future in tqdm(as_completed(futures), total=len(futures)):
# pass
with ThreadPoolExecutor(max_workers=process_num) as executor:
futures = [executor.submit(process_file, file) for file in os.listdir(f"./{wavPath}/{spks}")]
for future in tqdm(as_completed(futures), total=len(futures)):
pass

with Pool(processes=process_num) as pool:
results = [pool.apply_async(process_file, (file,)) for file in os.listdir(f"./{wavPath}/{spks}")]
for result in tqdm(results, total=len(results)):
result.wait()
# with Pool(processes=process_num) as pool:
# results = [pool.apply_async(process_file, (file,)) for file in os.listdir(f"./{wavPath}/{spks}")]
# for result in tqdm(results, total=len(results)):
# result.wait()

else:
file = spks
Expand Down

0 comments on commit c9367bb

Please sign in to comment.