Bugfix: Ensure logs are printed when streaming

This commit is contained in:
Andrei Betlen 2023-05-10 16:12:17 -04:00
parent 3c96b43cf4
commit cdeaded251

View file

@ -709,6 +709,9 @@ class Llama:
print("Llama._create_completion: cache save", file=sys.stderr) print("Llama._create_completion: cache save", file=sys.stderr)
self.cache[prompt_tokens + completion_tokens] = self.save_state() self.cache[prompt_tokens + completion_tokens] = self.save_state()
if self.verbose:
llama_cpp.llama_print_timings(self.ctx)
if stream: if stream:
yield { yield {
"id": completion_id, "id": completion_id,
@ -780,9 +783,6 @@ class Llama:
"top_logprobs": top_logprobs, "top_logprobs": top_logprobs,
} }
if self.verbose:
llama_cpp.llama_print_timings(self.ctx)
yield { yield {
"id": completion_id, "id": completion_id,
"object": "text_completion", "object": "text_completion",