RonanMcGovern
commited on
Commit
•
2883f51
1
Parent(s):
b48eff1
update license now that model has been updated
Browse files
README.md
CHANGED
@@ -10,20 +10,49 @@ tags:
|
|
10 |
- llama
|
11 |
- llama-2
|
12 |
- functions
|
|
|
13 |
---
|
14 |
-
#
|
15 |
|
16 |
## Description
|
17 |
|
18 |
-
This model extends the Llama 2 - 7B model with function calling capabilities. It allows users to make function calls within the model's input, making it capable of performing a variety of tasks.
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
|
|
23 |
|
24 |
-
|
|
|
|
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
```
|
29 |
pip install transformers
|
@@ -41,58 +70,79 @@ model = AutoModelForCausalLM.from_pretrained("Trelis/Llama-2-7b-chat-hf-function
|
|
41 |
To make a function call, you should format your input like this:
|
42 |
|
43 |
```
|
44 |
-
|
45 |
-
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
```
|
50 |
-
function_metadata = ```
|
51 |
{
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
},
|
62 |
-
"required": ["query"]
|
63 |
-
}
|
64 |
}
|
65 |
-
|
66 |
-
```
|
67 |
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
|
71 |
-
command = "Search the internet for Irish stew recipes."
|
72 |
```
|
73 |
|
74 |
-
|
75 |
|
76 |
```
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
```
|
79 |
|
80 |
-
|
81 |
-
|
82 |
```
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
```
|
85 |
|
86 |
-
You can then use response_json to access the function call and arguments.
|
87 |
-
|
88 |
It is recommended to handle cases where:
|
89 |
- There is no json object in the response
|
90 |
- The response contains text in addition to the json response
|
91 |
|
92 |
-
## Dataset
|
93 |
-
|
94 |
-
The dataset used for training this model can be found at [Trelis Function Calling Dataset] (https://huggingface.co/datasets/Trelis/function_calling).
|
95 |
-
|
96 |
## Quanitization Configurations
|
97 |
|
98 |
The following `bitsandbytes` quantization config was used during training:
|
@@ -119,7 +169,7 @@ The following `bitsandbytes` quantization config was used during training:
|
|
119 |
|
120 |
~
|
121 |
|
122 |
-
|
123 |
|
124 |
~
|
125 |
|
|
|
10 |
- llama
|
11 |
- llama-2
|
12 |
- functions
|
13 |
+
- function calling
|
14 |
---
|
15 |
+
# fLlama 2 - Function Calling Llama 2 - 7B
|
16 |
|
17 |
## Description
|
18 |
|
19 |
+
This model extends the hugging face Llama 2 - 7B model with function calling capabilities. It allows users to make function calls within the model's input, making it capable of performing a variety of tasks.
|
20 |
|
21 |
+
## Licensing and Usage
|
22 |
|
23 |
+
### Non-commercial Use
|
24 |
+
Trelis' **fLlama 2** is licensed for non-commercial use Creative Commons Attribution-NonCommercial (CC BY-NC)*.
|
25 |
|
26 |
+
Some examples of non-commercial use:
|
27 |
+
- Research within an academic institution
|
28 |
+
- Personal research
|
29 |
|
30 |
+
### Commercial Use
|
31 |
+
You can [purchase a life-time license here](https://buy.stripe.com/7sI14QcWhci71ck3ce) for commercial use for €9.99 per GPU/TPU. Commercial use of fLlama on a CPU is allowed for free.
|
32 |
+
|
33 |
+
*In addition to the above, all use of this model is further subject to terms in the [Meta license](https://ai.meta.com/resources/models-and-libraries/llama-downloads/).
|
34 |
+
|
35 |
+
Some examples of commercial use:
|
36 |
+
- Including or building on fLlama within a product or service, whether monetized or not.
|
37 |
+
- Using or building on fLlama for an internal company language model.
|
38 |
+
|
39 |
+
Commercial license examples:
|
40 |
+
- Running fLlama on a CPU = free
|
41 |
+
- Running fLlama on a CPU + GPU/TPU = 1 license required.
|
42 |
+
- Running fLlama sharded across 2 GPUs = 2 licenses required.
|
43 |
+
Licenses are transferable across different machines provided they are not running simultaneously.
|
44 |
+
|
45 |
+
Model weights are provided as-is, without warranty, and with the same disclaimers as provided by Meta (see Llama 2 below).
|
46 |
+
|
47 |
+
### Dataset Licensing
|
48 |
+
|
49 |
+
The dataset used for training this model can be found at [Trelis Function Calling Dataset] (https://huggingface.co/datasets/Trelis/function_calling).
|
50 |
+
|
51 |
+
The data may be used for free for commercial and non-commercial use. It is Apache 2 licensed and does not have any dependencies (i.e. does not depend on Meta's Llama license.)
|
52 |
+
|
53 |
+
## Inference with HuggingFace 🤗
|
54 |
+
|
55 |
+
Ensure you have the `transformers` package installed:
|
56 |
|
57 |
```
|
58 |
pip install transformers
|
|
|
70 |
To make a function call, you should format your input like this:
|
71 |
|
72 |
```
|
73 |
+
<s> [INST] <<SYS>>
|
74 |
+
You are a helpful research assistant. The following functions are available for you to fetch further data to answer user questions, if relevant:
|
75 |
|
76 |
+
{
|
77 |
+
"function": "search_bing",
|
78 |
+
"description": "Search the web for content on Bing. This allows users to search online/the internet/the web for content.",
|
79 |
+
"arguments": [
|
80 |
+
{
|
81 |
+
"name": "query",
|
82 |
+
"type": "string",
|
83 |
+
"description": "The search query string"
|
84 |
+
}
|
85 |
+
]
|
86 |
+
}
|
87 |
|
|
|
|
|
88 |
{
|
89 |
+
"function": "search_arxiv",
|
90 |
+
"description": "Search for research papers on ArXiv. Make use of AND, OR and NOT operators as appropriate to join terms within the query.",
|
91 |
+
"arguments": [
|
92 |
+
{
|
93 |
+
"name": "query",
|
94 |
+
"type": "string",
|
95 |
+
"description": "The search query string"
|
96 |
+
}
|
97 |
+
]
|
|
|
|
|
|
|
98 |
}
|
99 |
+
|
|
|
100 |
|
101 |
+
To call a function, respond - immediately and only - with a JSON object of the following format:
|
102 |
+
{
|
103 |
+
"function": "function_name",
|
104 |
+
"arguments": {
|
105 |
+
"argument1": "argument_value",
|
106 |
+
"argument2": "argument_value"
|
107 |
+
}
|
108 |
+
}
|
109 |
+
<</SYS>>
|
110 |
|
111 |
+
Find papers on high pressure batch reverse osmosis [/INST]
|
|
|
112 |
```
|
113 |
|
114 |
+
Notice that functionMetadata should be a string representation of a JSON object, like this:
|
115 |
|
116 |
```
|
117 |
+
"functionMetaData": {
|
118 |
+
"function": "search_bing",
|
119 |
+
"description": "Search the web for content on Bing. This allows users to search online/the internet/the web for content.",
|
120 |
+
"arguments": [
|
121 |
+
{
|
122 |
+
"name": "query",
|
123 |
+
"type": "string",
|
124 |
+
"description": "The search query string"
|
125 |
+
}
|
126 |
+
]
|
127 |
+
}
|
128 |
+
'''
|
129 |
```
|
130 |
|
131 |
+
and the language model should respond with a json object formatted like this:
|
|
|
132 |
```
|
133 |
+
{
|
134 |
+
"function": "function_name",
|
135 |
+
"arguments": {
|
136 |
+
"argument1": "argument_value",
|
137 |
+
"argument2": "argument_value"
|
138 |
+
}
|
139 |
+
}
|
140 |
```
|
141 |
|
|
|
|
|
142 |
It is recommended to handle cases where:
|
143 |
- There is no json object in the response
|
144 |
- The response contains text in addition to the json response
|
145 |
|
|
|
|
|
|
|
|
|
146 |
## Quanitization Configurations
|
147 |
|
148 |
The following `bitsandbytes` quantization config was used during training:
|
|
|
169 |
|
170 |
~
|
171 |
|
172 |
+
Below follows information on the original Llama 2 model...
|
173 |
|
174 |
~
|
175 |
|