Unverified Commit be067861 authored by Chauncey's avatar Chauncey Committed by GitHub
Browse files

[Frontend] Improve the performance of `is_reasoning_end` (#25735)


Signed-off-by: default avatarchaunceyjiang <chaunceyjiang@gmail.com>
parent 5bc26c43
...@@ -59,7 +59,8 @@ class BaseThinkingReasoningParser(ReasoningParser): ...@@ -59,7 +59,8 @@ class BaseThinkingReasoningParser(ReasoningParser):
) )
def is_reasoning_end(self, input_ids: list[int]) -> bool: def is_reasoning_end(self, input_ids: list[int]) -> bool:
return self.end_token_id in input_ids end_token_id = self.end_token_id
return any(input_id == end_token_id for input_id in reversed(input_ids))
def extract_content_ids(self, input_ids: list[int]) -> list[int]: def extract_content_ids(self, input_ids: list[int]) -> list[int]:
""" """
......
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