Skip to content

Commit

Permalink
Merge branch 'main' into qi-sdkk
Browse files Browse the repository at this point in the history
  • Loading branch information
qiqiWav committed Nov 15, 2024
2 parents fb46d8d + f36b776 commit 5ebd5c8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions nexa/gguf/nexa_inference_audio_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down Expand Up @@ -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:
"""
Expand Down

0 comments on commit 5ebd5c8

Please sign in to comment.