From a61ebb9949cf55831f5ee52bf52f8e80b75e4996 Mon Sep 17 00:00:00 2001 From: hpsun1109 Date: Tue, 9 Sep 2025 14:35:28 +0800 Subject: [PATCH] Update seed.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 兼容no think数据中包含\n\n\n\n;目前这部分数据budget被设置为512,正常应该是0 --- swift/llm/template/template/seed.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/swift/llm/template/template/seed.py b/swift/llm/template/template/seed.py index 4392b6c3c9..22dd8ce7ac 100644 --- a/swift/llm/template/template/seed.py +++ b/swift/llm/template/template/seed.py @@ -24,9 +24,10 @@ def get_thinking_budget(self, inputs: StdTemplateInputs): if '' in m['content'] and '' in m['content']: _, think = m['content'].split('', maxsplit=1) think, _ = think.split('', maxsplit=1) - thinking_token_len = len(self.tokenizer(think)['input_ids']) - if thinking_token_len > max_length: - max_length = thinking_token_len + if think.strip(): + thinking_token_len = len(self.tokenizer(think)['input_ids']) + if thinking_token_len > max_length: + max_length = thinking_token_len def convert_integer_v2(n): if n is None: