[Feature] Add auto-detection for reasoning_config when only reasoning_parser is set (#38214)
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
@@ -39,6 +39,20 @@ class ReasoningParser:
|
||||
# whereas all tokenizers have .get_vocab()
|
||||
return self.model_tokenizer.get_vocab()
|
||||
|
||||
@property
|
||||
def reasoning_start_str(self) -> str | None:
|
||||
"""Set `reasoning_start_str` to the strings that delimit
|
||||
the reasoning block (e.g. `""<seed:think>""` and `"<think>"`).
|
||||
"""
|
||||
return None
|
||||
|
||||
@property
|
||||
def reasoning_end_str(self) -> str | None:
|
||||
"""Set `reasoning_end_str` to the strings that delimit
|
||||
the reasoning block (e.g. `""</seed:think>""` and `"</think>"`).
|
||||
"""
|
||||
return None
|
||||
|
||||
@abstractmethod
|
||||
def is_reasoning_end(self, input_ids: Sequence[int]) -> bool:
|
||||
"""
|
||||
|
||||
@@ -39,6 +39,14 @@ class BaseThinkingReasoningParser(ReasoningParser):
|
||||
"""The token that ends reasoning content."""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def reasoning_start_str(self) -> str:
|
||||
return self.start_token
|
||||
|
||||
@property
|
||||
def reasoning_end_str(self) -> str:
|
||||
return self.end_token
|
||||
|
||||
def __init__(self, tokenizer: TokenizerLike, *args, **kwargs):
|
||||
super().__init__(tokenizer, *args, **kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user