fix: Clear kv cache to avoid kv bug when image is evaluated first

This commit is contained in:
Andrei Betlen 2024-05-10 02:38:10 -04:00
parent 4badac3a60
commit ac55d0a175

View file

@ -2637,6 +2637,7 @@ class Llava15ChatHandler:
# Evaluate prompt # Evaluate prompt
llama.reset() llama.reset()
llama._ctx.kv_cache_clear()
for type_, value in split_text: for type_, value in split_text:
if type_ == "text": if type_ == "text":
tokens = llama.tokenize(value.encode("utf8"), add_bos=False, special=True) tokens = llama.tokenize(value.encode("utf8"), add_bos=False, special=True)