Update README.md
Browse files
README.md
CHANGED
@@ -49,7 +49,6 @@ import json
|
|
49 |
from typing import Any, Dict, List
|
50 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
51 |
|
52 |
-
# Specify the desired model name here
|
53 |
model_name = "katanemo/Arch-Agent-7B"
|
54 |
|
55 |
model = AutoModelForCausalLM.from_pretrained(
|
@@ -57,8 +56,6 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
57 |
)
|
58 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
59 |
|
60 |
-
|
61 |
-
# Please use the recommended prompt for each model.
|
62 |
TASK_PROMPT = (
|
63 |
"You are a helpful assistant designed to assist with the user query by making one or more function calls if needed."
|
64 |
"\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\n"
|
@@ -94,7 +91,6 @@ tools = [
|
|
94 |
}
|
95 |
]
|
96 |
|
97 |
-
|
98 |
# Helper function to create the system prompt for our model
|
99 |
def format_prompt(tools: List[Dict[str, Any]]):
|
100 |
tool_text = "\n".join(
|
@@ -102,7 +98,6 @@ def format_prompt(tools: List[Dict[str, Any]]):
|
|
102 |
)
|
103 |
return TASK_PROMPT.format(tool_text=tool_text)
|
104 |
|
105 |
-
|
106 |
system_prompt = format_prompt(tools)
|
107 |
|
108 |
messages = [
|
@@ -110,7 +105,6 @@ messages = [
|
|
110 |
{"role": "user", "content": "What is the weather in Seattle?"},
|
111 |
]
|
112 |
|
113 |
-
#### 2.2.3 Run inference
|
114 |
model_inputs = tokenizer.apply_chat_template(
|
115 |
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
|
116 |
).to(model.device)
|
|
|
49 |
from typing import Any, Dict, List
|
50 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
51 |
|
|
|
52 |
model_name = "katanemo/Arch-Agent-7B"
|
53 |
|
54 |
model = AutoModelForCausalLM.from_pretrained(
|
|
|
56 |
)
|
57 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
58 |
|
|
|
|
|
59 |
TASK_PROMPT = (
|
60 |
"You are a helpful assistant designed to assist with the user query by making one or more function calls if needed."
|
61 |
"\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\n"
|
|
|
91 |
}
|
92 |
]
|
93 |
|
|
|
94 |
# Helper function to create the system prompt for our model
|
95 |
def format_prompt(tools: List[Dict[str, Any]]):
|
96 |
tool_text = "\n".join(
|
|
|
98 |
)
|
99 |
return TASK_PROMPT.format(tool_text=tool_text)
|
100 |
|
|
|
101 |
system_prompt = format_prompt(tools)
|
102 |
|
103 |
messages = [
|
|
|
105 |
{"role": "user", "content": "What is the weather in Seattle?"},
|
106 |
]
|
107 |
|
|
|
108 |
model_inputs = tokenizer.apply_chat_template(
|
109 |
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
|
110 |
).to(model.device)
|