diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index eda22164a5..40a2b811f2 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -1243,10 +1243,18 @@ def generate( if longest_prefix == len(tokens): if self.is_hybrid and (self._hybrid_cache_mgr is None or self._hybrid_cache_mgr.max_checkpoints <= 0): if self.verbose: - print(f"Llama.generate: Full match on disabled hybrid cache. Skipping prefix-- to use existing fresh logits.", file=sys.stderr) + print(f"Llama.generate: Full match(tokens) on disabled hybrid cache. Skipping prefix-- to use existing fresh logits.", file=sys.stderr) else: if self.verbose: - print(f"Llama.generate: Full match. Forcing prefix-- to evaluate 1 token.", file=sys.stderr) + print(f"Llama.generate: Full match(tokens). Forcing prefix-- to evaluate 1 token.", file=sys.stderr) + longest_prefix -= 1 + if longest_prefix == self.n_tokens: + if self.is_hybrid and (self._hybrid_cache_mgr is None or self._hybrid_cache_mgr.max_checkpoints <= 0): + if self.verbose: + print(f"Llama.generate: Full match(n_tokens) on disabled hybrid cache. Skipping prefix-- to use existing fresh logits.", file=sys.stderr) + else: + if self.verbose: + print(f"Llama.generate: Full match(n_tokens). Forcing prefix-- to evaluate 1 token.", file=sys.stderr) longest_prefix -= 1 # Physically erase trailing "ghost" tokens from the C++ KV cache diff --git a/vendor/llama.cpp b/vendor/llama.cpp index d23355afc3..892e3c333a 160000 --- a/vendor/llama.cpp +++ b/vendor/llama.cpp @@ -1 +1 @@ -Subproject commit d23355afc319f598d0e588a2d16a4da82e14ff41 +Subproject commit 892e3c333a634f818acc195dc699468c08ff5e80