Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6b018e0

Browse filesBrowse files
committed
misc: Improve llava error messages
1 parent a6457ba commit 6b018e0
Copy full SHA for 6b018e0

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎llama_cpp/llama_chat_format.py

Copy file name to clipboardExpand all lines: llama_cpp/llama_chat_format.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,13 +2642,13 @@ def embed_image_bytes(image_bytes: bytes):
26422642
if type_ == "text":
26432643
tokens = llama.tokenize(value.encode("utf8"), add_bos=False, special=True)
26442644
if llama.n_tokens + len(tokens) > llama.n_ctx():
2645-
raise ValueError("Prompt exceeds n_ctx") # TODO: Fix
2645+
raise ValueError(f"Prompt exceeds n_ctx: {llama.n_tokens + len(tokens)} > {llama.n_ctx()}")
26462646
llama.eval(tokens)
26472647
else:
26482648
image_bytes = self.load_image(value)
26492649
embed = embed_image_bytes(image_bytes)
26502650
if llama.n_tokens + embed.contents.n_image_pos > llama.n_ctx():
2651-
raise ValueError("Prompt exceeds n_ctx") # TODO: Fix
2651+
raise ValueError(f"Prompt exceeds n_ctx: {llama.n_tokens + embed.contents.n_image_pos} > {llama.n_ctx()}")
26522652
n_past = ctypes.c_int(llama.n_tokens)
26532653
n_past_p = ctypes.pointer(n_past)
26542654
with suppress_stdout_stderr(disable=self.verbose):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.