edgerunner-research commited on
Commit
e83d478
·
verified ·
1 Parent(s): 8937e86

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +214 -184
README.md CHANGED
@@ -1,199 +1,229 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
- <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
 
 
 
11
 
12
- ## Model Details
 
 
13
 
14
- ### Model Description
 
 
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
 
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
 
 
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- <!-- Provide the basic links for the model. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
-
115
- #### Factors
116
-
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
-
119
- [More Information Needed]
120
-
121
- #### Metrics
122
-
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
-
125
- [More Information Needed]
126
-
127
- ### Results
128
-
129
- [More Information Needed]
130
-
131
- #### Summary
132
-
133
-
134
-
135
- ## Model Examination [optional]
136
-
137
- <!-- Relevant interpretability work for the model goes here -->
138
-
139
- [More Information Needed]
140
-
141
- ## Environmental Impact
142
-
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
-
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
-
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
-
153
- ## Technical Specifications [optional]
154
-
155
- ### Model Architecture and Objective
156
-
157
- [More Information Needed]
158
-
159
- ### Compute Infrastructure
160
-
161
- [More Information Needed]
162
-
163
- #### Hardware
164
-
165
- [More Information Needed]
166
-
167
- #### Software
168
-
169
- [More Information Needed]
170
-
171
- ## Citation [optional]
172
-
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
-
175
- **BibTeX:**
176
-
177
- [More Information Needed]
178
-
179
- **APA:**
180
-
181
- [More Information Needed]
182
-
183
- ## Glossary [optional]
184
-
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
-
187
- [More Information Needed]
188
-
189
- ## More Information [optional]
190
-
191
- [More Information Needed]
192
-
193
- ## Model Card Authors [optional]
194
-
195
- [More Information Needed]
196
-
197
- ## Model Card Contact
198
-
199
- [More Information Needed]
 
1
  ---
2
  library_name: transformers
3
+ base_model:
4
+ - Qwen/Qwen2.5-7B-Instruct
5
  ---
6
 
7
+ # Model Card for EdgeRunner-Comand-Nested-FC-v3
8
 
9
+ EdgeRunner-Comand-Nested is an advanced large language model designed specifically for handling complex nested function calls within personal domains. Initialized from Qwen2.5-7B-Instruct, further enhanced by the integration of the Hermes function call template and additional training on a specialized dataset (based on TinyAgent). This extra dataset focuses on personal domain applications, providing the model with a robust understanding of nested function scenarios that are typical in complex user interactions.
10
 
11
+ ### Data Processing Process
12
 
13
+ #### 1. **Data Augmentation:**
14
+ - **TinyAgent Augmentation:**
15
+ TinyAgent consists of 16 core functions, but each sample only requires a subset of these functions to work. To ensure diversity and avoid overfitting, we used an augmentation technique where each sample is provided with a random superset of functions. This superset covers all the functions that the specific sample requires but is always a subset of the 16 total functions available in TinyAgent. By doing so, we allow the model to generalize across various combinations of functions while still providing the necessary context for each sample to execute correctly.
16
 
17
+ #### 2. **Additional Data Samples:**
18
+ - **GPT-4o Augmented Samples:**
19
+ To further enhance the dataset, we used GPT-4 for function synthesis in the personal assistant domain. This was done by using a pipeline that automatically generates function definitions, corresponding queries, and execution plans. After generating the function data, each sample was verified for validity to ensure the correctness of the functional outputs. Through this pipeline, we produced approximately 2,000 additional samples. These samples follow the TinyAgent format but introduce a broader range of new and more complex functions. This expanded set of functions enriches the model's understanding of diverse scenarios, allowing it to handle more varied function calls beyond the synthesis-based functions of TinyAgent, thereby improving its ability to generalize across tasks.
20
 
21
+ #### 3. **Data Conversion:**
22
+ - **Hermes Format Conversion:**
23
+ All function call data, including those from TinyAgent, the additional samples generated, and the function call data we had previously, were converted to the Hermes format. In TinyAgent, the Hermes format uses the `$ + number` format to indicate nested use cases. This ensures consistency in data representation while also clearly defining nested function use cases for enhanced interpretability. Standardizing all data in Hermes format allows the model to efficiently process and understand function calls across a variety of scenarios.
24
 
25
+ ### Example Code
26
 
27
+ ```python
28
+ from transformers import AutoModelForCausalLM, AutoTokenizer
29
+ import torch
30
 
31
+ model_id = "edgerunner-ai/EdgeRunner-Command-Nested"
32
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
 
 
 
 
 
33
 
34
+ # You can find the full tools list here https://jsonblob.com/1290566717196328960
35
+ tools = [{
36
+ "name": "open_and_get_file_path",
37
+ "description": "Opens the file and returns its path.",
38
+ "parameters": {
39
+ "type": "object",
40
+ "properties": {
41
+ "file_name": {
42
+ "type": "str",
43
+ "description": "The name of the file to open"
44
+ }
45
+ },
46
+ "required": [
47
+ "file_name"
48
+ ]
49
+ }
50
+ }, ...]
51
 
52
+ conversation = [{
53
+ "role": "user",
54
+ "content": "Send an email to Andrea attached with the file 'report.pdf' and ask when he is available for a meeting."
55
+ }]
56
+
57
+ # Render the tool use prompt as a string:
58
+ tool_use_prompt = tokenizer.apply_chat_template(
59
+ conversation,
60
+ tools=tools,
61
+ tokenize=False,
62
+ add_generation_prompt=True,
63
+ )
64
+
65
+ inputs = tokenizer(tool_use_prompt, return_tensors="pt")
66
+
67
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
68
+
69
+ outputs = model.generate(**inputs, max_new_tokens=1000)
70
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
71
+ ```
72
+
73
+ # Examples
74
+
75
+ ## Simple function
76
+
77
+ ### Single turn
78
+
79
+ ```markdown
80
+ **User:**
81
+ How is the weather today in New York?
82
+
83
+ **Assistant:**
84
+ I don't have direct access to real-time data like current weather conditions. However, I can help you find out by performing a web search. Let me do that now.
85
+
86
+ <tool_call>
87
+ {"name": "web_search", "arguments": {"query": "weather today New York"}}
88
+ </tool_call>
89
+ ```
90
+
91
+ ### Multi turn
92
+
93
+ ```markdown
94
+ **User:**
95
+ I want to search for some information about music, can you help me with that?
96
+
97
+ **Assistant:**
98
+ Of course! What specific information about music are you looking for?
99
+
100
+ **User:**
101
+ I'm looking for information about the history of rock music.
102
+
103
+ **Assistant:**
104
+ <tool_call>
105
+ {"name": "web_search", "arguments": {"query": "history of rock music"}}
106
+ </tool_call>
107
+ ```
108
+
109
+ ```markdown
110
+ **User:**
111
+ I want to search for some information about music, can you help me with that?
112
+
113
+ **Assistant:**
114
+ Of course! What specific information about music are you looking for?
115
+
116
+ **User:**
117
+ I'm looking for information about the history of rock music and also information about Justin Bieber.
118
+
119
+ **Assistant:**
120
+ <tool_call>
121
+ {"name": "web_search", "arguments": {"query": "history of rock music"}}
122
+ </tool_call>
123
+ <tool_call>
124
+ {"name": "web_search", "arguments": {"query": "information about Justin Bieber"}}
125
+ </tool_call>
126
+ ```
127
+
128
+ ## Nested functions
129
+
130
+ ### Success
131
+
132
+ ```markdown
133
+ **User:**
134
+ Create a meeting with Mr.A and Mr.B to discuss Edgerunner on 27/9/2024 at 5:00 PM.
135
+
136
+ **Assistant:**
137
+ <tool_call>
138
+ {"name": "get_email_address", "arguments": {"name": "Mr.A"}}
139
+ </tool_call>
140
+ <tool_call>
141
+ {"name": "get_email_address", "arguments": {"name": "Mr.B"}}
142
+ </tool_call>
143
+ <tool_call>
144
+ {"name": "create_calendar_event", "arguments": {"title": "Edgerunner Discussion", "start_date": "2024-09-27 17:00:00", "end_date": "2024-09-27 18:00:00", "location": "", "invitees": ["$1", "$2"], "notes": "", "calendar": null}}
145
+ </tool_call>
146
+ ```
147
+
148
+ ```markdown
149
+ **User:**
150
+ Generate an image with the prompt 'A beautiful landscape with mountains and a lake' and send it to the Discord server with the message 'Here is a beautiful landscape'.
151
+
152
+ **Assistant:**
153
+ <tool_call>
154
+ {"name": "generate_image", "arguments": {"prompt": "A beautiful landscape with mountains and a lake"}}
155
+ </tool_call>
156
+ <tool_call>
157
+ {"name": "send_to_discord", "arguments": {"message": "Here is a beautiful landscape.", "attachments": ["$1"]}}
158
+ </tool_call>
159
+ ```
160
+
161
+
162
+ ```markdown
163
+ **User:**
164
+ Send the directions to the Eiffel Tower from the Louvre Museum to Mr. C and Mr. D with an SMS message.
165
+
166
+ **Assistant:**
167
+ <tool_call>
168
+ {"name": "get_phone_number", "arguments": {"name": "Mr.C"}}
169
+ </tool_call>
170
+ <tool_call>
171
+ {"name": "get_phone_number", "arguments": {"name": "Mr.D"}}
172
+ </tool_call>
173
+ <tool_call>
174
+ {"name": "maps_show_directions", "arguments": {"start_location": "Louvre Museum", "end_location": "Eiffel Tower", "transport": "d"}}
175
+ </tool_call>
176
+ <tool_call>
177
+ {"name": "send_sms", "arguments": {"recipients": ["$1", "$2"], "message": "Here are the directions to get from Louvre Museum to Eiffel Tower: $3"}}
178
+ </tool_call>
179
+ ```
180
+
181
+ ```markdown
182
+ **User:**
183
+ Send an email to Mr. A attached with the file 'report.pdf' and ask when he is available for a meeting.
184
+
185
+ **Assistant:**
186
+ <tool_call>
187
+ {"name": "get_email_address", "arguments": {"name": "Mr.A"}}
188
+ </tool_call>
189
+ <tool_call>
190
+ {"name": "open_and_get_file_path", "arguments": {"file_name": "report.pdf"}}
191
+ </tool_call>
192
+ <tool_call>
193
+ {"name": "compose_new_email", "arguments": {"recipients": ["$1"], "cc": [], "subject": "Availability for Meeting", "context": "Please find the attached report. When are you available for a meeting?", "attachments": ["$2"]}}
194
+ </tool_call>
195
+ ```
196
+
197
+ ### Failed
198
+
199
+ ```markdown
200
+ **User:**
201
+ I want to generate an image and send it to Discord. Can you help me with that?
202
+
203
+ **Assistant:**
204
+ Of course! Could you please provide me with a description or prompt for the image you would like to generate?
205
+
206
+ **User:**
207
+ I want to generate an image of a cat with a gray background.
208
+
209
+ **Assistant:**
210
+ <tool_call>
211
+ {"name": "generate_image", "arguments": {"prompt": "a cat with a gray background"}}
212
+ </tool_call>
213
+ <tool_call>
214
+ {"name": "send_to_discord", "arguments": {"message": "", "attachments": ["$1"]}}
215
+ </tool_call>
216
+ ```
217
+
218
+ # Benchmarks
219
+
220
+ ## Berkeley Function Calling Benchmark Results
221
+
222
+ | Test Name | EdgeRunner-Command-Nested| Qwen/Qwen2.5-7B-Instruct |
223
+ |-----------------------------|------------------------------------------------|--------------------------|
224
+ | multiple_function | 0.95 | 0.81 |
225
+ | parallel_multiple_function | 0.84 | 0.655 |
226
+ | parallel_function | 0.86 | 0.69 |
227
+ | simple | 0.96 | 0.9275 |
228
+ | irrelevance | 0.74 | 0.625 |
229