From cdeaded2516509b10e9494c2884dcef8b06a4fe2 Mon Sep 17 00:00:00 2001 From: Andrei Betlen Date: Wed, 10 May 2023 16:12:17 -0400 Subject: [PATCH] Bugfix: Ensure logs are printed when streaming --- llama_cpp/llama.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index 7be51e1..bbce4b2 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -709,6 +709,9 @@ class Llama: print("Llama._create_completion: cache save", file=sys.stderr) self.cache[prompt_tokens + completion_tokens] = self.save_state() + if self.verbose: + llama_cpp.llama_print_timings(self.ctx) + if stream: yield { "id": completion_id, @@ -780,9 +783,6 @@ class Llama: "top_logprobs": top_logprobs, } - if self.verbose: - llama_cpp.llama_print_timings(self.ctx) - yield { "id": completion_id, "object": "text_completion",