File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -2642,13 +2642,13 @@ def embed_image_bytes(image_bytes: bytes):
2642
2642
if type_ == "text" :
2643
2643
tokens = llama .tokenize (value .encode ("utf8" ), add_bos = False , special = True )
2644
2644
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 () } " )
2646
2646
llama .eval (tokens )
2647
2647
else :
2648
2648
image_bytes = self .load_image (value )
2649
2649
embed = embed_image_bytes (image_bytes )
2650
2650
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 () } " )
2652
2652
n_past = ctypes .c_int (llama .n_tokens )
2653
2653
n_past_p = ctypes .pointer (n_past )
2654
2654
with suppress_stdout_stderr (disable = self .verbose ):
You can’t perform that action at this time.
0 commit comments