diff --git a/nexa/gguf/nexa_inference_audio_lm.py b/nexa/gguf/nexa_inference_audio_lm.py index 8fb8134a..1accc5dd 100644 --- a/nexa/gguf/nexa_inference_audio_lm.py +++ b/nexa/gguf/nexa_inference_audio_lm.py @@ -166,13 +166,14 @@ def run(self): stop_spinner(stop_event, spinner_thread) 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: """ @@ -242,12 +243,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: """