Update README.md
Browse files
README.md
CHANGED
@@ -1,201 +1,164 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
library_name: transformers
|
3 |
-
|
4 |
---
|
|
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
##
|
13 |
|
14 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
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 |
-
##
|
|
|
37 |
|
38 |
-
|
39 |
|
40 |
-
### Direct Use
|
41 |
|
42 |
-
|
43 |
|
44 |
-
|
|
|
45 |
|
46 |
-
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
|
|
|
|
|
|
53 |
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
|
56 |
-
|
57 |
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
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]
|
200 |
|
|
|
|
|
|
|
|
|
201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
metrics:
|
6 |
+
- accuracy
|
7 |
+
tags:
|
8 |
+
- api
|
9 |
+
- open-api
|
10 |
+
- swagger
|
11 |
+
- api doc
|
12 |
+
- api call
|
13 |
+
- code
|
14 |
+
- instruction_tuned
|
15 |
+
- basemodel
|
16 |
+
- pytorch
|
17 |
+
- RL Tuned
|
18 |
+
- text-generation-inferenc
|
19 |
library_name: transformers
|
20 |
+
pipeline_tag: text-generation
|
21 |
---
|
22 |
+
# pip-api-expert
|
23 |
|
24 |
+
[pipableAi](https://pipable.ai/)
|
25 |
|
26 |
+
[colab_notebook]()
|
27 |
|
28 |
+
## What have we built?
|
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 |
+
```javascript
|
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
|
36 |
+
```
|
37 |
|
38 |
+
## How we built it?
|
39 |
|
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 |
|
56 |
+
## Usage
|
57 |
|
|
|
58 |
|
59 |
+
### Installation
|
60 |
|
61 |
+
```bash
|
62 |
+
pip install transformers
|
63 |
|
64 |
+
```
|
65 |
|
66 |
+
### Prompt
|
67 |
+
```python
|
68 |
+
prompt = f"""<schema>{schema}</schema>
|
69 |
+
<question>{question}</question>
|
70 |
+
<sql>"""
|
71 |
+
```
|
72 |
|
73 |
+
### PyTorch
|
74 |
+
```python
|
75 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
76 |
+
device = "cuda"
|
77 |
+
model = AutoModelForCausalLM.from_pretrained("PipableAI/pip-sql-1.3b")
|
78 |
+
tokenizer = AutoTokenizer.from_pretrained("PipableAI/pip-sql-1.3b")
|
79 |
|
80 |
+
inputs = tokenizer(text, return_tensors="pt")
|
81 |
+
outputs = model.generate(**inputs, max_new_tokens=200)
|
82 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True).split('<sql>')[1].split('</sql>')[0])
|
83 |
+
```
|
84 |
|
|
|
85 |
|
86 |
+
## Examples
|
87 |
|
88 |
+
### Schema
|
89 |
+
```sql
|
90 |
+
CREATE TABLE Products (
|
91 |
+
product_id number,
|
92 |
+
parent_product_id number,
|
93 |
+
product_name text,
|
94 |
+
product_price number,
|
95 |
+
product_color text,
|
96 |
+
product_size text,
|
97 |
+
product_description text);
|
98 |
|
99 |
+
CREATE TABLE Customers (
|
100 |
+
customer_id number,
|
101 |
+
gender_code text,
|
102 |
+
customer_first_name text,
|
103 |
+
customer_middle_initial text,
|
104 |
+
customer_last_name text,
|
105 |
+
email_address text,
|
106 |
+
login_name text,
|
107 |
+
login_password text,
|
108 |
+
phone_number text,
|
109 |
+
address_line_1 text,
|
110 |
+
town_city text,
|
111 |
+
county text,
|
112 |
+
country text);
|
113 |
|
114 |
+
CREATE TABLE Customer_Payment_Methods (
|
115 |
+
customer_id number,
|
116 |
+
payment_method_code text);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
+
CREATE TABLE Invoices (
|
119 |
+
invoice_number number,
|
120 |
+
invoice_status_code text,
|
121 |
+
invoice_date time);
|
122 |
|
123 |
+
CREATE TABLE Orders (
|
124 |
+
order_id number,
|
125 |
+
customer_id number,
|
126 |
+
order_status_code text,
|
127 |
+
date_order_placed time);
|
128 |
+
|
129 |
+
CREATE TABLE Order_Items (
|
130 |
+
order_item_id number,
|
131 |
+
product_id number,
|
132 |
+
order_id number,
|
133 |
+
order_item_status_code text);
|
134 |
+
|
135 |
+
CREATE TABLE Shipments (
|
136 |
+
shipment_id number,
|
137 |
+
order_id number,
|
138 |
+
invoice_number number,
|
139 |
+
shipment_tracking_number text,
|
140 |
+
shipment_date time);
|
141 |
+
|
142 |
+
CREATE TABLE Shipment_Items (
|
143 |
+
shipment_id number,
|
144 |
+
order_item_id number);
|
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
|