diff --git a/README.md b/README.md index 93f0c0211..be1fadd0c 100644 --- a/README.md +++ b/README.md @@ -515,7 +515,7 @@ huggingface-cli login ```bash git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git cd LLaMA-Factory -pip install -e ".[metrics]" --no-build-isolation +pip install -e ".[metrics]" ``` Optional dependencies available: `metrics`, `deepspeed`. Install with: `pip install -e ".[metrics,deepspeed]"` diff --git a/README_zh.md b/README_zh.md index b1027f3fc..ed42041d1 100644 --- a/README_zh.md +++ b/README_zh.md @@ -517,7 +517,7 @@ huggingface-cli login ```bash git clone --depth 1 https://github.com/hiyouga/LLaMA-Factory.git cd LLaMA-Factory -pip install -e ".[metrics]" --no-build-isolation +pip install -e ".[metrics]" ``` 可选的额外依赖项:`metrics`、`deepspeed`。使用 `pip install -e ".[metrics,deepspeed]"` 安装。 diff --git a/src/llamafactory/data/template.py b/src/llamafactory/data/template.py index a986388d6..d196ae388 100644 --- a/src/llamafactory/data/template.py +++ b/src/llamafactory/data/template.py @@ -1676,7 +1676,9 @@ register_template( register_template( name="minimax1", format_user=StringFormatter( - slots=["user name=user\n{{content}}\nai name=assistant\n"] + slots=[ + "user name=user\n{{content}}\nai name=assistant\n" + ] ), format_assistant=StringFormatter(slots=["{{content}}\n"]), format_system=StringFormatter( @@ -1684,7 +1686,9 @@ register_template( ), format_function=FunctionFormatter(slots=["{{content}}\n"], tool_format="minimax1"), format_observation=StringFormatter( - slots=["tool name=tools\n{{content}}\nai name=assistant\n"] + slots=[ + "tool name=tools\n{{content}}\nai name=assistant\n" + ] ), format_tools=ToolFormatter(tool_format="minimax1"), default_system="You are a helpful assistant.", diff --git a/src/llamafactory/data/tool_utils.py b/src/llamafactory/data/tool_utils.py index 95fb0ac56..48132af84 100644 --- a/src/llamafactory/data/tool_utils.py +++ b/src/llamafactory/data/tool_utils.py @@ -65,15 +65,15 @@ MINIMAX_M1_TOOL_PROMPT = ( "You are provided with these tools:\n\n{tool_text}\n\n" "If you need to call tools, please respond with XML tags, and provide tool-name and " "json-object of arguments, following the format below:\n\n" - "{{\"name\": , \"arguments\": }}\n...\n" + """{{"name": , "arguments": }}\n...\n""" ) MINIMAX_M2_TOOL_PROMPT = ( "\n\n# Tools\n\nYou may call one or more tools to assist with the user query.\n" "Here are the tools available in JSONSchema format:\n\n\n{tool_text}\n\n" "When making tool calls, use XML format to invoke tools and pass parameters:\n" - "\n\n\nparam-value-1\n" - "param-value-2\n...\n\n" + """\n\n\nparam-value-1\n""" + """param-value-2\n...\n\n""" ) QWEN_TOOL_PROMPT = ( @@ -334,9 +334,9 @@ class MiniMaxM2ToolUtils(ToolUtils): function_texts = [] for func in functions: name, arguments = func.name, json.loads(func.arguments) - prompt = "" + prompt = f'' for key, value in arguments.items(): - prompt += "\n" + prompt += f'\n' if not isinstance(value, str): value = json.dumps(value, ensure_ascii=False) prompt += value + "" @@ -346,9 +346,7 @@ class MiniMaxM2ToolUtils(ToolUtils): @override @staticmethod def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: - regex = re.compile( - r"\s*(.+?)\s*", re.DOTALL - ) + regex = re.compile(r"\s*(.+?)\s*", re.DOTALL) tool_match = re.search(regex, content) if not tool_match: return content