Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][qwen2audio example] temporarily fix the nonsense output issue of qwen2audio #228

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions nexa/gguf/nexa_inference_audio_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ def _load_model(self):
0x7FFFFFFF if self.n_gpu_layers == -1 else self.n_gpu_layers
) # 0x7FFFFFFF is INT32 max, will be auto set to all layers

self.context = audio_lm_cpp.init_context(
ctypes.byref(self.ctx_params), is_qwen=self.is_qwen
)
if not self.context:
raise RuntimeError("Failed to load audio language model")
logging.debug("Model loaded successfully")
# self.context = audio_lm_cpp.init_context(
# ctypes.byref(self.ctx_params), is_qwen=self.is_qwen
# )
# if not self.context:
# raise RuntimeError("Failed to load audio language model")
# logging.debug("Model loaded successfully")
except Exception as e:
logging.error(f"Error loading model: {e}")
raise
Expand Down Expand Up @@ -190,6 +190,13 @@ def inference(self, audio_path: str, prompt: str = "") -> str:
self.ctx_params.file = ctypes.c_char_p(audio_path.encode("utf-8"))
self.ctx_params.prompt = ctypes.c_char_p(prompt.encode("utf-8"))

self.context = audio_lm_cpp.init_context(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we need to do same thing for omni-VLM

ctypes.byref(self.ctx_params), is_qwen=self.is_qwen
)
if not self.context:
raise RuntimeError("Failed to load audio language model")
logging.debug("Model loaded successfully")

response = audio_lm_cpp.process_full(
self.context, ctypes.byref(self.ctx_params), is_qwen=self.is_qwen
)
Expand Down
Loading