Update README.md
Browse files
README.md
CHANGED
@@ -27,20 +27,20 @@ NaturalQuery matches the state of the art models in text to sql for it's size an
|
|
27 |
Here is a write up, small test done [here](https://chatdb.ai/post/naturalsql-vs-sqlcoder-for-text-to-sql).
|
28 |
|
29 |
# Table of Contents
|
30 |
-
1. [Benchmarks](#
|
31 |
-
|
32 |
-
|
33 |
-
2. [Future Improvements](#
|
34 |
-
3. [Usage](#
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
##
|
44 |
|
45 |
## SQL-Eval on novel datasets not seen in training
|
46 |
|
@@ -48,7 +48,7 @@ Here is a write up, small test done [here](https://chatdb.ai/post/naturalsql-vs-
|
|
48 |
|
49 |
<em>Big thanks to the [defog](https://huggingface.co/defog) team for open sourcing [sql-eval](https://github.com/defog-ai/sql-eval)</em>👏
|
50 |
|
51 |
-
##
|
52 |
|
53 |
**NaturalQuery-6.7B-v0 matches or outperforms other industry leading models in multiple categories!**
|
54 |
|
@@ -56,14 +56,14 @@ Here is a write up, small test done [here](https://chatdb.ai/post/naturalsql-vs-
|
|
56 |
|
57 |
_The **date** category will be a strong focus in the next iteration of `v1`._
|
58 |
|
59 |
-
|
60 |
|
61 |
- Much larger training set
|
62 |
- More complex schemas, questions, and queries
|
63 |
- Strong focus on Date Queries
|
64 |
- Reward modeling via DPO
|
65 |
|
66 |
-
#
|
67 |
|
68 |
Make sure you have the correct version of the transformers library installed:
|
69 |
|
@@ -71,7 +71,7 @@ Make sure you have the correct version of the transformers library installed:
|
|
71 |
pip install transformers==4.35.2
|
72 |
```
|
73 |
|
74 |
-
###
|
75 |
|
76 |
Use the following Python code to load the model:
|
77 |
|
@@ -86,7 +86,7 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
86 |
)
|
87 |
```
|
88 |
|
89 |
-
###
|
90 |
|
91 |
To generate text, use the following Python code. [Here](https://gist.github.com/cfahlgren1/ba17f01cf688c4229686dc3dfb4d4549) is a full notebook with the SQL table prompt format to use.
|
92 |
|
@@ -105,7 +105,7 @@ print(tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True))
|
|
105 |
```
|
106 |
|
107 |
|
108 |
-
#
|
109 |
|
110 |
```
|
111 |
### Task
|
@@ -125,9 +125,9 @@ Here is the SQL query that answers the question: `{natural language question}`
|
|
125 |
'''sql
|
126 |
```
|
127 |
|
128 |
-
#
|
129 |
|
130 |
-
###
|
131 |
|
132 |
```sql
|
133 |
CREATE TABLE users (
|
@@ -171,6 +171,7 @@ CREATE TABLE comments (
|
|
171 |
user_id INTEGER REFERENCES users(user_id)
|
172 |
);
|
173 |
```
|
|
|
174 |
|
175 |
**Question**: **Show me the day with the most users joining**
|
176 |
```sql
|
|
|
27 |
Here is a write up, small test done [here](https://chatdb.ai/post/naturalsql-vs-sqlcoder-for-text-to-sql).
|
28 |
|
29 |
# Table of Contents
|
30 |
+
1. [Benchmarks](#benchmarks)
|
31 |
+
- [SQL-Eval on novel datasets not seen in training](#sql-eval-on-novel-datasets-not-seen-in-training)
|
32 |
+
- [SQL-Eval by SQL Category](#sql-eval-by-sql-category)
|
33 |
+
2. [Future Improvements](#future-improvements)
|
34 |
+
3. [Usage](#usage)
|
35 |
+
- [Loading the Model](#loading-the-model)
|
36 |
+
- [Generating Text](#generating-text)
|
37 |
+
4. [SQL Generation Template](#sql-generation-template)
|
38 |
+
5. [Example SQL Output](#example-sql-output)
|
39 |
+
- [Example Schemas](#example-schemas)
|
40 |
+
- [Example SQL Outputs](#example-sql-outputs)
|
41 |
+
|
42 |
+
|
43 |
+
## Benchmarks
|
44 |
|
45 |
## SQL-Eval on novel datasets not seen in training
|
46 |
|
|
|
48 |
|
49 |
<em>Big thanks to the [defog](https://huggingface.co/defog) team for open sourcing [sql-eval](https://github.com/defog-ai/sql-eval)</em>👏
|
50 |
|
51 |
+
## SQL-Eval by SQL Category
|
52 |
|
53 |
**NaturalQuery-6.7B-v0 matches or outperforms other industry leading models in multiple categories!**
|
54 |
|
|
|
56 |
|
57 |
_The **date** category will be a strong focus in the next iteration of `v1`._
|
58 |
|
59 |
+
## Future Improvements
|
60 |
|
61 |
- Much larger training set
|
62 |
- More complex schemas, questions, and queries
|
63 |
- Strong focus on Date Queries
|
64 |
- Reward modeling via DPO
|
65 |
|
66 |
+
# Usage
|
67 |
|
68 |
Make sure you have the correct version of the transformers library installed:
|
69 |
|
|
|
71 |
pip install transformers==4.35.2
|
72 |
```
|
73 |
|
74 |
+
### Loading the Model
|
75 |
|
76 |
Use the following Python code to load the model:
|
77 |
|
|
|
86 |
)
|
87 |
```
|
88 |
|
89 |
+
### Generating Text
|
90 |
|
91 |
To generate text, use the following Python code. [Here](https://gist.github.com/cfahlgren1/ba17f01cf688c4229686dc3dfb4d4549) is a full notebook with the SQL table prompt format to use.
|
92 |
|
|
|
105 |
```
|
106 |
|
107 |
|
108 |
+
# SQL Generation Template
|
109 |
|
110 |
```
|
111 |
### Task
|
|
|
125 |
'''sql
|
126 |
```
|
127 |
|
128 |
+
# Example SQL Output
|
129 |
|
130 |
+
### Example Schemas
|
131 |
|
132 |
```sql
|
133 |
CREATE TABLE users (
|
|
|
171 |
user_id INTEGER REFERENCES users(user_id)
|
172 |
);
|
173 |
```
|
174 |
+
### Example SQL Outputs
|
175 |
|
176 |
**Question**: **Show me the day with the most users joining**
|
177 |
```sql
|