Skip to content

Commit 22df747

Browse files
committed
fix: Correct the mtmd vision check condition bug
1 parent 8b29b88 commit 22df747

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

llama_cpp/llama_chat_format.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,13 +2892,16 @@ def _init_mtmd_context(self, llama_model: llama.Llama):
28922892
raise ValueError(f"{self.log_prefix}(_init_mtmd_context): Failed to load mtmd context from: {self.clip_model_path}")
28932893

28942894
# Check if vision is supported
2895-
if self._mtmd_cpp.mtmd_support_vision(self.mtmd_ctx) and self.verbose:
2896-
print(f"{self.log_prefix}(_init_mtmd_context): Vision support detected.", file=sys.stderr)
2895+
if self._mtmd_cpp.mtmd_support_vision(self.mtmd_ctx):
2896+
if self.verbose:
2897+
print(f"{self.log_prefix}(_init_mtmd_context): Vision support detected.", file=sys.stderr)
28972898
else:
2898-
raise ValueError("Vision is not supported by this model")
2899+
raise ValueError(f"{self.log_prefix}(_init_mtmd_context): Vision is not supported by this model")
2900+
28992901
# Check if audio is supported
2900-
if self._mtmd_cpp.mtmd_support_audio(self.mtmd_ctx) and self.verbose:
2901-
print(f"{self.log_prefix}(_init_mtmd_context): Audio support detected.", file=sys.stderr)
2902+
if self._mtmd_cpp.mtmd_support_audio(self.mtmd_ctx):
2903+
if self.verbose:
2904+
print(f"{self.log_prefix}(_init_mtmd_context): Audio support detected.", file=sys.stderr)
29022905

29032906
def close(self) -> None:
29042907
"""Explicitly free the mtmd context and vision model resources."""

0 commit comments

Comments
 (0)