From e7d00d9e7773293eea0c9b1d08938190bbf3a5e2 Mon Sep 17 00:00:00 2001 From: Pavel Esir Date: Mon, 6 Jan 2025 20:57:24 +0100 Subject: [PATCH] Fix text streaming in samples --- samples/python/multinomial_causal_lm/multinomial_causal_lm.py | 2 +- tools/llm_bench/llm_bench_utils/ov_utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/python/multinomial_causal_lm/multinomial_causal_lm.py b/samples/python/multinomial_causal_lm/multinomial_causal_lm.py index 78a14e1e1d..9e43294ae5 100755 --- a/samples/python/multinomial_causal_lm/multinomial_causal_lm.py +++ b/samples/python/multinomial_causal_lm/multinomial_causal_lm.py @@ -91,7 +91,7 @@ def put(self, token_id: int) -> bool: word = text[self.print_len:] self.tokens_cache = [] self.print_len = 0 - elif len(text) >= 3 and text[-3:] == chr(65533): + elif len(text) >= 3 and text[-1] == chr(65533): # Don't print incomplete text. pass elif len(text) > self.print_len + delay_n_chars: diff --git a/tools/llm_bench/llm_bench_utils/ov_utils.py b/tools/llm_bench/llm_bench_utils/ov_utils.py index 3d3b0980c9..f9a93ae2a3 100644 --- a/tools/llm_bench/llm_bench_utils/ov_utils.py +++ b/tools/llm_bench/llm_bench_utils/ov_utils.py @@ -562,7 +562,7 @@ def put(self, token_id: int) -> bool: word = text[self.print_len:] self.tokens_cache = [] self.print_len = 0 - elif len(text) >= 3 and text[-3:] == chr(65533): + elif len(text) >= 3 and text[-1] == chr(65533): # Don't print incomplete text. pass elif len(text) > self.print_len: