fix stop when stream (#11462)

Signed-off-by: ybyang <ybyang7@iflytek.com>
Co-authored-by: Liangsheng Yin <lsyincs@gmail.com>
Co-authored-by: Liangsheng Yin <hnyls2002@gmail.com>
This commit is contained in:
ybyang
2025-10-11 22:06:31 +08:00
committed by GitHub
co-authored by Liangsheng Yin Liangsheng Yin
parent c8452551ce
commit 5061b8fd3e
2 changed files with 41 additions and 3 deletions
@@ -680,12 +680,18 @@ class SchedulerOutputProcessorMixin:
stream_interval = (
req.sampling_params.stream_interval or self.stream_interval
)
# origin stream_interval logic
should_output = (
len(req.output_ids) % stream_interval == 1
if not self.model_config.is_multimodal_gen
and stream_interval > 1
else len(req.output_ids) % stream_interval == 0
)
if should_output:
# check_match_stop_str_prefix if tail_str's suffix match stop_str prefix
should_output &= not req.check_match_stop_str_prefix()
else:
should_output = (
len(req.output_ids) % DEFAULT_FORCE_STREAM_INTERVAL == 0