From e520b021a5ca97d961512d6c3c13eed8f99d0fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=BA?= Date: Fri, 15 Nov 2024 09:06:33 +0800 Subject: [PATCH] dedicated api calling to ensure proper running of qwen2audio WIP to imporve --- nexa/gguf/nexa_inference_audio_lm.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/nexa/gguf/nexa_inference_audio_lm.py b/nexa/gguf/nexa_inference_audio_lm.py index f93153fc..cdbe182c 100644 --- a/nexa/gguf/nexa_inference_audio_lm.py +++ b/nexa/gguf/nexa_inference_audio_lm.py @@ -154,13 +154,14 @@ def run(self): with suppress_stdout_stderr(): response = self.inference(audio_path, user_input) print(f"{response}") + self.cleanup() except KeyboardInterrupt: print("\nExiting...") except Exception as e: logging.error(f"\nError during audio generation: {e}", exc_info=True) - finally: - self.cleanup() + # finally: + # self.cleanup() def _get_valid_audio_path(self) -> str: """ @@ -230,12 +231,12 @@ def cleanup(self): pass self.temp_file = None - def __del__(self): - """ - Destructor to free the Bark context when the instance is deleted. - """ - if self.context: - audio_lm_cpp.free(self.context, is_qwen=self.is_qwen) + # def __del__(self): + # """ + # Destructor to free the Bark context when the instance is deleted. + # """ + # if self.context: + # audio_lm_cpp.free(self.context, is_qwen=self.is_qwen) def _ensure_16khz(self, audio_path: str) -> str: """