mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-23 06:12:50 +08:00
fix: 修复function call数据集如果 function_call 值的为不合法json,异常提示且中断训练。
Former-commit-id: 953e1a0fb226e63b797cab0007c53d3ebc6456bb
This commit is contained in:
parent
27da57b179
commit
daa1309466
@ -113,7 +113,7 @@ class FunctionFormatter(Formatter):
|
||||
functions.append((tool_call["name"], json.dumps(tool_call["arguments"], ensure_ascii=False)))
|
||||
|
||||
except json.JSONDecodeError:
|
||||
functions = []
|
||||
raise RuntimeError("Not Valid functions Message {}".format(str([content])))
|
||||
|
||||
elements = []
|
||||
for name, arguments in functions:
|
||||
@ -141,7 +141,8 @@ class ToolFormatter(Formatter):
|
||||
tools = json.loads(content)
|
||||
return [self.tool_utils.tool_formatter(tools) if len(tools) != 0 else ""]
|
||||
except json.JSONDecodeError:
|
||||
return [""]
|
||||
raise RuntimeError("Not Valid functions Message {}".format(str([content])))
|
||||
|
||||
|
||||
@override
|
||||
def extract(self, content: str) -> Union[str, List["FunctionCall"]]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user