From ac55d0a175115d1e719672ce1cb1bec776c738b1 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Fri, 10 May 2024 02:38:10 -0400 Subject: [PATCH] fix: Clear kv cache to avoid kv bug when image is evaluated first --- llama_cpp/llama_chat_format.py | 1 + 1 file changed, 1 insertion(+) diff --git a/llama_cpp/llama_chat_format.py b/llama_cpp/llama_chat_format.py index d795b30..e2d7e27 100644 --- a/llama_cpp/llama_chat_format.py +++ b/llama_cpp/llama_chat_format.py @@ -2637,6 +2637,7 @@ class Llava15ChatHandler: # Evaluate prompt llama.reset() + llama._ctx.kv_cache_clear() for type_, value in split_text: if type_ == "text": tokens = llama.tokenize(value.encode("utf8"), add_bos=False, special=True)