[Perf] Optimize Python Slice for Structured Output using islice instead of [:] (#33593)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
Signed-off-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Wentao Ye
2026-02-24 09:02:36 -08:00
committed by GitHub
co-authored by gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent c38b8d5a31
commit 9ce8fad2a9
8 changed files with 23 additions and 16 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ class MistralReasoningParser(BaseThinkingReasoningParser):
def is_reasoning_end(self, input_ids: Sequence[int]) -> bool:
has_eot_token = False
for id in input_ids[::-1]:
for id in reversed(input_ids):
if id == self.start_token_id:
# Reasoning ends only if a BOT token is found before a EOT token.
return has_eot_token