Skip to content

Commit 21acd79

Browse files
committed
Re-enable cache
1 parent 6639371 commit 21acd79

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llama_cpp/llama.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -831,9 +831,7 @@ def _create_completion(
831831
"logprobs is not supported for models created with logits_all=False"
832832
)
833833

834-
# Temporarily disable usage of the cache
835-
# See: https://github.com/abetlen/llama-cpp-python/issues/348#issuecomment-1583072408
836-
if self.cache and False:
834+
if self.cache:
837835
try:
838836
cache_item = self.cache[prompt_tokens]
839837
cache_prefix_len = Llama.longest_token_prefix(
@@ -1071,14 +1069,14 @@ def _create_completion(
10711069
}
10721070
],
10731071
}
1074-
if self.cache and False:
1072+
if self.cache:
10751073
if self.verbose:
10761074
print("Llama._create_completion: cache save", file=sys.stderr)
10771075
self.cache[prompt_tokens + completion_tokens] = self.save_state()
10781076
print("Llama._create_completion: cache saved", file=sys.stderr)
10791077
return
10801078

1081-
if self.cache and False:
1079+
if self.cache:
10821080
if self.verbose:
10831081
print("Llama._create_completion: cache save", file=sys.stderr)
10841082
self.cache[prompt_tokens + completion_tokens] = self.save_state()

0 commit comments

Comments
 (0)