Skip to content

Instantly share code, notes, and snippets.

@aidiary
Created December 19, 2019 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aidiary/f85ef86d9828d91096ffe66ac7c7743f to your computer and use it in GitHub Desktop.
Save aidiary/f85ef86d9828d91096ffe66ac7c7743f to your computer and use it in GitHub Desktop.
特徴量抽出の並列化方法
func_args = []
for wav_file in sorted(os.listdir(wav_dir)):
prefix = os.path.splitext(wav_file)[0]
wav_path = os.path.join(wav_dir, wav_file)
mulaw_path = os.path.join(mulaw_dir, '{}.npy'.format(prefix))
melspec_path = os.path.join(melspec_dir, '{}.npy'.format(prefix))
func_args.append((extract_features, wav_path, mulaw_path, melspec_path, config))
with Pool(os.cpu_count()) as p:
for result in tqdm.tqdm(p.imap_unordered(argwrapper, func_args), total=len(func_args)):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment