add a initializer

This commit is contained in:
Ziyuan Wang
2023-03-09 16:27:18 +00:00
parent a6a067de44
commit c39dccc1fd

View File

@@ -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",