Unverified Commit 54d35447 authored by Sherry's avatar Sherry Committed by GitHub
Browse files

Fix: Output text is always truncated in some models (#3016)

parent 703e42ee
......@@ -980,7 +980,10 @@ class LLMEngine:
def _finalize_sequence(self, seq: Sequence,
sampling_params: SamplingParams,
stop_string: str) -> None:
if not sampling_params.include_stop_str_in_output and stop_string:
if sampling_params.include_stop_str_in_output:
return
if stop_string and seq.output_text.endswith(stop_string):
# Truncate the output text so that the stop string is
# not included in the output.
seq.output_text = seq.output_text[:-len(stop_string)]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment