Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update hammer handler and add Hammer2.1 model #832

Merged
merged 4 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -601,27 +601,27 @@
"Salesforce",
"cc-by-nc-4.0",
],
"MadeAgents/Hammer2.0-7b": [
"Hammer2.0-7b (FC)",
"https://huggingface.co/MadeAgents/Hammer2.0-7b",
"MadeAgents/Hammer2.1-7b": [
"Hammer2.1-7b (FC)",
"https://huggingface.co/MadeAgents/Hammer2.1-7b",
"MadeAgents",
"cc-by-nc-4.0",
],
"MadeAgents/Hammer2.0-3b": [
"Hammer2.0-3b (FC)",
"https://huggingface.co/MadeAgents/Hammer2.0-3b",
"MadeAgents/Hammer2.1-3b": [
"Hammer2.1-3b (FC)",
"https://huggingface.co/MadeAgents/Hammer2.1-3b",
"MadeAgents",
"cc-by-nc-4.0",
"qwen-research",
HuanzhiMao marked this conversation as resolved.
Show resolved Hide resolved
],
"MadeAgents/Hammer2.0-1.5b": [
"Hammer2.0-1.5b (FC)",
"https://huggingface.co/MadeAgents/Hammer2.0-1.5b",
"MadeAgents/Hammer2.1-1.5b": [
"Hammer2.1-1.5b (FC)",
"https://huggingface.co/MadeAgents/Hammer2.1-1.5b",
"MadeAgents",
"cc-by-nc-4.0",
],
"MadeAgents/Hammer2.0-0.5b": [
"Hammer2.0-0.5b (FC)",
"https://huggingface.co/MadeAgents/Hammer2.0-0.5b",
"MadeAgents/Hammer2.1-0.5b": [
"Hammer2.1-0.5b (FC)",
"https://huggingface.co/MadeAgents/Hammer2.1-0.5b",
"MadeAgents",
"cc-by-nc-4.0",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
1. Make one or more function/tool calls to meet the request based on the question.
2. If none of the function can be used, point it out and refuse to answer.
3. If the given question lacks the parameters required by the function, also point it out.
"""

The following are characters that may interact with you
1. user: Provides query or additional information.
2. tool: Returns the results of the tool calling.
"""
FORMAT_INSTRUCTION = """
The output MUST strictly adhere to the following JSON format, and NO other text MUST be included.
The example format is as follows. Please make sure the parameter type is correct. If no function call is needed, please directly output an empty list '[]'
Expand Down Expand Up @@ -73,9 +76,7 @@ def convert_to_format_tool(tools):
user_query = ""

for message in messages:
user_query += f"{message['role']}: {message['content']}\n"
if messages[-1]["role"] != "user":
user_query += "user: \n"
user_query += f"<|im_start|>{message['role']}\n{message['content']}<|im_end|>\n"

content = f"[BEGIN OF TASK INSTRUCTION]\n{TASK_INSTRUCTION}\n[END OF TASK INSTRUCTION]\n\n"
content += (
Expand All @@ -84,9 +85,7 @@ def convert_to_format_tool(tools):
+ "\n[END OF AVAILABLE TOOLS]\n\n"
)
content += f"[BEGIN OF FORMAT INSTRUCTION]\n{FORMAT_INSTRUCTION}\n[END OF FORMAT INSTRUCTION]\n\n"
content += f"[BEGIN OF QUERY]\n{user_query}\n[END OF QUERY]\n\n"

return f"<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{content}<|im_end|>\n<|im_start|>assistant\n"
return f"<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{content}<|im_end|>\n{user_query}<|im_start|>assistant\n"

@override
def decode_ast(self, result, language="Python"):
Expand Down