mirror of
https://github.com/hiyouga/LlamaFactory.git
synced 2026-01-31 20:03:39 +00:00
[model] support Seed-OSS (#8992)
Co-authored-by: Yaowei Zheng <hiyouga@buaa.edu.cn>
This commit is contained in:
@@ -97,8 +97,11 @@ class FunctionFormatter(StringFormatter):
|
||||
@override
|
||||
def apply(self, **kwargs) -> SLOTS:
|
||||
content: str = kwargs.pop("content")
|
||||
regex = re.compile(r"<think>(.*)</think>", re.DOTALL)
|
||||
thought = re.search(regex, content)
|
||||
thought_words, thought = kwargs.pop("thought_words", None), None
|
||||
if thought_words and len(thought_words)== 2:
|
||||
regex = re.compile(rf"{re.escape(thought_words[0])}(.*?){re.escape(thought_words[1])}", re.DOTALL)
|
||||
thought = re.search(regex, content)
|
||||
|
||||
if thought:
|
||||
content = content.replace(thought.group(0), "")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user