From 0f4be9b352ac993f9a2f7e476092f6b07ba0e256 Mon Sep 17 00:00:00 2001 From: Yanli Date: Thu, 13 Jun 2024 16:03:02 +0800 Subject: [PATCH] update inference_pool --- src/gpt_sovits/infer/inference_pool.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gpt_sovits/infer/inference_pool.py b/src/gpt_sovits/infer/inference_pool.py index e0fbe7d9..02371763 100644 --- a/src/gpt_sovits/infer/inference_pool.py +++ b/src/gpt_sovits/infer/inference_pool.py @@ -123,7 +123,11 @@ def get_tts_wav_stream( for task in tasks ] for future in futures: - yield future.result() + try: + yield future.result() + except Exception as e: + self.pool.shutdown(wait=False) + raise e def get_tts_wav( self, @@ -149,3 +153,6 @@ def get_tts_wav( return audio_list[0][0], np.concatenate( [data for _, data in audio_list], axis=0 ) + + def __del__(self): + self.pool.shutdown(wait=False)