Update README.md
Browse files
README.md
CHANGED
@@ -29,7 +29,7 @@ pipeline_tag: text-generation
|
|
29 |
A 1.3 bn state of the art model for api calling , documentation, testing management.
|
30 |
The tasks that the model can accomplish are the following.
|
31 |
|
32 |
-
```
|
33 |
1. Convert any bad format text to open api
|
34 |
2. Convert any bad format text to mark down.
|
35 |
3. Given docs generate and execute the api call in python
|
@@ -40,16 +40,6 @@ The tasks that the model can accomplish are the following.
|
|
40 |
We used a simulator and a form of policy gradient to train the model to self instruct itself to make documents and then perform executable calls on the document.
|
41 |
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
## Benchmarking :
|
46 |
-
For benchmarking purposes we are using Semantic Evaluation for Text-to-SQL with
|
47 |
-
Distilled Test Suites, an officially accepted evaluation framework for Spider, SParC, and CoSQL which was proposed by a research team of Yale and Berkeley.
|
48 |
-
The benchmark contains 2200 test data points
|
49 |
-
Here is the link to run the evaluation:
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
## License
|
54 |
The model is open source under apache 2.0. License
|
55 |
|
@@ -60,105 +50,182 @@ The model is open source under apache 2.0. License
|
|
60 |
|
61 |
```bash
|
62 |
pip install transformers
|
63 |
-
|
64 |
```
|
65 |
|
66 |
### Prompt
|
67 |
```python
|
68 |
-
prompt = f"""<
|
69 |
-
<
|
70 |
-
<sql>"""
|
71 |
```
|
72 |
|
73 |
### PyTorch
|
74 |
```python
|
75 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
83 |
```
|
84 |
|
85 |
|
86 |
## Examples
|
87 |
|
88 |
-
###
|
89 |
-
```
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
```
|
146 |
|
147 |
-
### Questions
|
148 |
-
What are the email address, town and county of the customers who are of the least common gender?
|
149 |
-
```sql
|
150 |
-
SELECT email_address , town_city , county FROM customers GROUP BY gender_code ORDER BY count(*) ASC LIMIT 1
|
151 |
-
```
|
152 |
|
153 |
-
What are the product price and the product size of the products whose price is above average?
|
154 |
-
```sql
|
155 |
-
SELECT product_price , product_size FROM products WHERE product_price > (SELECT avg(product_price) FROM products)
|
156 |
-
```
|
157 |
-
|
158 |
-
Which customers did not make any orders? List the first name, middle initial and last name.
|
159 |
-
```sql
|
160 |
-
SELECT T1.customer_first_name , T1.customer_middle_initial , T1.customer_last_name FROM Customers AS T1 WHERE T1.customer_id NOT IN (SELECT T2.customer_id FROM Orders AS T2)
|
161 |
-
```
|
162 |
|
163 |
### Team
|
164 |
Avi Kothari, Pratham Gupta, Ritvik Aryan Kalra, Rohan Bhatial, Soham Acharya
|
|
|
29 |
A 1.3 bn state of the art model for api calling , documentation, testing management.
|
30 |
The tasks that the model can accomplish are the following.
|
31 |
|
32 |
+
```markdown
|
33 |
1. Convert any bad format text to open api
|
34 |
2. Convert any bad format text to mark down.
|
35 |
3. Given docs generate and execute the api call in python
|
|
|
40 |
We used a simulator and a form of policy gradient to train the model to self instruct itself to make documents and then perform executable calls on the document.
|
41 |
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
## License
|
44 |
The model is open source under apache 2.0. License
|
45 |
|
|
|
50 |
|
51 |
```bash
|
52 |
pip install transformers
|
53 |
+
pip install accelerate
|
54 |
```
|
55 |
|
56 |
### Prompt
|
57 |
```python
|
58 |
+
prompt = f"""<question>{}</question>
|
59 |
+
<doc/code/any tag that explains the task at hand>"""
|
|
|
60 |
```
|
61 |
|
62 |
### PyTorch
|
63 |
```python
|
64 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
65 |
+
from accelerate import Accelerator
|
66 |
+
import torch
|
67 |
+
path = "PipableAI/pip-api-expert"
|
68 |
+
model =AutoModelForCausalLM.from_pretrained(path,torch_dtype=torch.bfloat16,device_map="auto")
|
69 |
+
tokenizer = AutoTokenizer.from_pretrained(path)
|
70 |
+
prompt = "<question>Perform api call to do task k</question><python_code>"
|
71 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
72 |
+
outputs = model.generate(**inputs, max_new_tokens=1200)
|
73 |
+
doc = (
|
74 |
+
tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
|
75 |
+
)
|
76 |
+
print(doc)
|
77 |
```
|
78 |
|
79 |
|
80 |
## Examples
|
81 |
|
82 |
+
### markdown documentation
|
83 |
+
```markdown
|
84 |
+
swagger_docs = """
|
85 |
+
Method access
|
86 |
+
HTTP
|
87 |
+
JavaScript
|
88 |
+
Python
|
89 |
+
Java
|
90 |
+
POST
|
91 |
+
https://slack.com/api/chat.postMessage
|
92 |
+
Required scopes
|
93 |
+
Bot tokens
|
94 |
+
chat:write
|
95 |
+
User tokens
|
96 |
+
chat:write
|
97 |
+
chat:write:user
|
98 |
+
chat:write:bot
|
99 |
+
Legacy bot tokens
|
100 |
+
bot
|
101 |
+
Content types
|
102 |
+
application/x-www-form-urlencoded
|
103 |
+
application/json
|
104 |
+
Rate limits
|
105 |
+
Special
|
106 |
+
Arguments
|
107 |
+
Required arguments
|
108 |
+
token
|
109 |
+
token
|
110 |
+
·Required
|
111 |
+
Authentication token bearing required scopes. Tokens should be passed as an HTTP Authorization header or alternatively, as a POST parameter.
|
112 |
+
Example
|
113 |
+
xxxx-xxxxxxxxx-xxxx
|
114 |
+
channel
|
115 |
+
string
|
116 |
+
·Required
|
117 |
+
Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
|
118 |
+
Example
|
119 |
+
C1234567890
|
120 |
+
At least one of
|
121 |
+
attachmentsblockstext
|
122 |
+
One of these arguments is required to describe the content of the message. If attachments or blocks are included, text will be used as fallback text for notifications only.
|
123 |
+
attachments
|
124 |
+
string
|
125 |
+
blocks
|
126 |
+
blocks[] as string
|
127 |
+
text
|
128 |
+
string
|
129 |
+
How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
|
130 |
+
Example
|
131 |
+
Hello world
|
132 |
+
Optional arguments
|
133 |
+
as_user
|
134 |
+
boolean
|
135 |
+
·Optional
|
136 |
+
(Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic Slack apps. See authorship below.
|
137 |
+
Example
|
138 |
+
true
|
139 |
+
icon_emoji
|
140 |
+
string
|
141 |
+
·Optional
|
142 |
+
Emoji to use as the icon for this message. Overrides icon_url.
|
143 |
+
Example
|
144 |
+
:chart_with_upwards_trend:
|
145 |
+
icon_url
|
146 |
+
string
|
147 |
+
·Optional
|
148 |
+
URL to an image to use as the icon for this message.
|
149 |
+
Example
|
150 |
+
http://lorempixel.com/48/48
|
151 |
+
link_names
|
152 |
+
boolean
|
153 |
+
·Optional
|
154 |
+
Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead.
|
155 |
+
Example
|
156 |
+
true
|
157 |
+
metadata
|
158 |
+
string
|
159 |
+
·Optional
|
160 |
+
JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.
|
161 |
+
Example
|
162 |
+
{"event_type": "task_created", "event_payload": { "id": "11223", "title": "Redesign Homepage"}}
|
163 |
+
mrkdwn
|
164 |
+
boolean
|
165 |
+
·Optional
|
166 |
+
Disable Slack markup parsing by setting to false. Enabled by default.
|
167 |
+
Default
|
168 |
+
true
|
169 |
+
Example
|
170 |
+
false
|
171 |
+
parse
|
172 |
+
string
|
173 |
+
·Optional
|
174 |
+
Change how messages are treated. See below.
|
175 |
+
Example
|
176 |
+
full
|
177 |
+
reply_broadcast
|
178 |
+
boolean
|
179 |
+
·Optional
|
180 |
+
Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
|
181 |
+
Example
|
182 |
+
true
|
183 |
+
thread_ts
|
184 |
+
string
|
185 |
+
·Optional
|
186 |
+
Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
|
187 |
+
unfurl_links
|
188 |
+
boolean
|
189 |
+
·Optional
|
190 |
+
Pass true to enable unfurling of primarily text-based content.
|
191 |
+
Example
|
192 |
+
true
|
193 |
+
unfurl_media
|
194 |
+
boolean
|
195 |
+
·Optional
|
196 |
+
Pass false to disable unfurling of media content.
|
197 |
+
Example
|
198 |
+
false
|
199 |
+
username
|
200 |
+
string
|
201 |
+
·Optional
|
202 |
+
Set your bot's user name.
|
203 |
+
Example
|
204 |
+
My Bot
|
205 |
+
"""
|
206 |
+
|
207 |
+
question = """
|
208 |
+
Convert the above docs to markdown format.
|
209 |
+
"""
|
210 |
+
|
211 |
+
prompt = f"""
|
212 |
+
<api_doc>
|
213 |
+
{swagger_docs}
|
214 |
+
</api_doc>
|
215 |
+
<question>
|
216 |
+
{question}
|
217 |
+
</question>
|
218 |
+
<response>
|
219 |
+
"""
|
220 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
221 |
+
outputs = model.generate(**inputs, max_new_tokens=1800)
|
222 |
+
doc = (
|
223 |
+
tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
|
224 |
+
)
|
225 |
+
print(doc)
|
226 |
```
|
227 |
|
|
|
|
|
|
|
|
|
|
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
### Team
|
231 |
Avi Kothari, Pratham Gupta, Ritvik Aryan Kalra, Rohan Bhatial, Soham Acharya
|