From 478a77091fdf35a6564511282dc449acf91c2563 Mon Sep 17 00:00:00 2001 From: Xu Song Date: Tue, 6 Aug 2024 11:20:37 +0800 Subject: [PATCH] Refactor all_text to remaining_text --- llama_cpp/llama.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index 0cb5ca2fc..98c73c969 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -1409,15 +1409,15 @@ def logit_bias_processor( if stream: remaining_tokens = completion_tokens[returned_tokens:] - all_text = self.detokenize( + remaining_text = self.detokenize( remaining_tokens, prev_tokens=prompt_tokens + completion_tokens[:returned_tokens], ) - any_stop = [s for s in stop_sequences if s in all_text] + any_stop = [s for s in stop_sequences if s in remaining_text] if len(any_stop) > 0: - end = min(all_text.index(stop) for stop in any_stop) + end = min(remaining_text.index(stop) for stop in any_stop) else: - end = len(all_text) + end = len(remaining_text) token_end_position = 0 for token in remaining_tokens: