From c39dccc1fd2298f7842fa3d2b05bed13050b1c94 Mon Sep 17 00:00:00 2001 From: Ziyuan Wang Date: Thu, 9 Mar 2023 16:27:18 +0000 Subject: [PATCH] add a initializer --- examples/parallel_example.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/parallel_example.ipynb b/examples/parallel_example.ipynb index 3db2a1c..039767c 100644 --- a/examples/parallel_example.ipynb +++ b/examples/parallel_example.ipynb @@ -77,7 +77,7 @@ " wav = read_audio(audio_file, sampling_rate=SAMPLING_RATE)\n", " return get_speech_timestamps(\n", " wav,\n", - " model,\n", + " vad_model,\n", " 0.46, # speech prob threshold\n", " 16000, # sample rate\n", " 300, # min speech duration in ms\n", @@ -107,7 +107,7 @@ "futures = []\n", "NUM_COPIES=20\n", "\n", - "with ProcessPoolExecutor(max_workers=NUM_PROCESS) as ex:\n", + "with ProcessPoolExecutor(max_workers=NUM_PROCESS, initializer=init_model, initargs=(model,)) as ex:\n", " for i in range(NUM_COPIES):\n", " futures.append(ex.submit(vad_process, f\"en_example{idx}.wav\"))\n", "\n",