RonanMcGovern commited on
Commit
2883f51
1 Parent(s): b48eff1

update license now that model has been updated

Browse files
Files changed (1) hide show
  1. README.md +90 -40
README.md CHANGED
@@ -10,20 +10,49 @@ tags:
10
  - llama
11
  - llama-2
12
  - functions
 
13
  ---
14
- # Llama 2 - 7B Model With Function Calling Capabilities
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
- !!! This is an early proof of concept. Please post issues and questions !!!
21
 
22
- Use of this model is governed by the [Meta license](https://ai.meta.com/resources/models-and-libraries/llama-downloads/).
 
23
 
24
- ## Usage
 
 
25
 
26
- Firstly, ensure you have the `transformers` package installed:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- input_text = f'<<SYS>>You are a helpful research assistant. The following functions, if any, are available for you to fetch further data to answer user questions: {function_metadata}<</SYS>>[INST]Your user command here[/INST]'
45
- ```
46
 
47
- Function metadata should be a string representation of a JSON object, like this:
 
 
 
 
 
 
 
 
 
 
48
 
49
- ```
50
- function_metadata = ```
51
  {
52
- "name": "search_bing",
53
- "description": "Search the web for content on Bing. This allows users to search online/the internet/the web for content.",
54
- "parameters": {
55
- "type": "object",
56
- "properties": {
57
- "query": {
58
- "type": "string",
59
- "description": "The search query string"
60
- }
61
- },
62
- "required": ["query"]
63
- }
64
  }
65
- '''
66
- ```
67
 
68
- An example command would be:
 
 
 
 
 
 
 
 
69
 
70
- ```
71
- command = "Search the internet for Irish stew recipes."
72
  ```
73
 
74
- So, the whole input would look like this:
75
 
76
  ```
77
- input_text = f'<<SYS>>You are a helpful research assistant. The following functions, if any, are available for you to fetch further data to answer user questions: {function_metadata}<</SYS>>[INST]{command}[/INST]'
 
 
 
 
 
 
 
 
 
 
 
78
  ```
79
 
80
- The model's response will be a JSON object containing the function call. Here's how you can parse it:
81
-
82
  ```
83
- response_json = json.loads(response)
 
 
 
 
 
 
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
- All details below are copied from the original repo.
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