diff --git a/src/llmtuner/data/formatter.py b/src/llmtuner/data/formatter.py index ce7b2819..f1c35308 100644 --- a/src/llmtuner/data/formatter.py +++ b/src/llmtuner/data/formatter.py @@ -44,9 +44,9 @@ class FunctionFormatter: def __call__(self, content: str) -> List[Union[str, Dict[str, str]]]: try: function = json.loads(content) - name = json.dumps(function["name"], ensure_ascii=False) + name = function["name"] arguments = json.dumps(function["arguments"], ensure_ascii=False) - except json.JSONDecodeError: + except Exception: name, arguments = "", "" elements = [] @@ -98,5 +98,5 @@ class ToolFormatter: if self.type == "default": return [self._default(tools)] - except json.JSONDecodeError: + except Exception: return [""]