uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
sqlcoder-7b-2 - bnb 4bits
|
11 |
+
- Model creator: https://huggingface.co/defog/
|
12 |
+
- Original model: https://huggingface.co/defog/sqlcoder-7b-2/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
license: cc-by-sa-4.0
|
20 |
+
library_name: transformers
|
21 |
+
pipeline_tag: text-generation
|
22 |
+
---
|
23 |
+
# Update notice
|
24 |
+
The model weights were updated at 7 AM UTC on Feb 7, 2024. The new model weights lead to a much more performant model – particularly for joins.
|
25 |
+
|
26 |
+
If you downloaded the model before that, please redownload the weights for best performance.
|
27 |
+
|
28 |
+
# Model Card for SQLCoder-7B-2
|
29 |
+
|
30 |
+
A capable large language model for natural language to SQL generation.
|
31 |
+
|
32 |
+

|
33 |
+
|
34 |
+
## Model Details
|
35 |
+
|
36 |
+
### Model Description
|
37 |
+
|
38 |
+
<!-- Provide a longer summary of what this model is. -->
|
39 |
+
|
40 |
+
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
41 |
+
|
42 |
+
- **Developed by:** [Defog, Inc](https://defog.ai)
|
43 |
+
- **Model type:** [Text to SQL]
|
44 |
+
- **License:** [CC-by-SA-4.0]
|
45 |
+
- **Finetuned from model:** [CodeLlama-7B]
|
46 |
+
|
47 |
+
### Model Sources [optional]
|
48 |
+
- [**HuggingFace:**](https://huggingface.co/defog/sqlcoder-70b-alpha)
|
49 |
+
- [**GitHub:**](https://github.com/defog-ai/sqlcoder)
|
50 |
+
- [**Demo:**](https://defog.ai/sqlcoder-demo/)
|
51 |
+
|
52 |
+
## Uses
|
53 |
+
|
54 |
+
This model is intended to be used by non-technical users to understand data inside their SQL databases. It is meant as an analytics tool, and not as a database admin tool.
|
55 |
+
|
56 |
+
This model has not been trained to reject malicious requests from users with write access to databases, and should only be used by users with read-only access.
|
57 |
+
|
58 |
+
## How to Get Started with the Model
|
59 |
+
|
60 |
+
Use the code [here](https://github.com/defog-ai/sqlcoder/blob/main/inference.py) to get started with the model.
|
61 |
+
|
62 |
+
## Prompt
|
63 |
+
|
64 |
+
Please use the following prompt for optimal results. Please remember to use `do_sample=False` and `num_beams=4` for optimal results.
|
65 |
+
|
66 |
+
```
|
67 |
+
### Task
|
68 |
+
Generate a SQL query to answer [QUESTION]{user_question}[/QUESTION]
|
69 |
+
|
70 |
+
### Database Schema
|
71 |
+
The query will run on a database with the following schema:
|
72 |
+
{table_metadata_string_DDL_statements}
|
73 |
+
|
74 |
+
### Answer
|
75 |
+
Given the database schema, here is the SQL query that [QUESTION]{user_question}[/QUESTION]
|
76 |
+
[SQL]
|
77 |
+
```
|
78 |
+
|
79 |
+
## Evaluation
|
80 |
+
|
81 |
+
This model was evaluated on [SQL-Eval](https://github.com/defog-ai/sql-eval), a PostgreSQL based evaluation framework developed by Defog for testing and alignment of model capabilities.
|
82 |
+
|
83 |
+
You can read more about the methodology behind SQLEval [here](https://defog.ai/blog/open-sourcing-sqleval/).
|
84 |
+
|
85 |
+
### Results
|
86 |
+
|
87 |
+
We classified each generated question into one of 6 categories. The table displays the percentage of questions answered correctly by each model, broken down by category.
|
88 |
+
|
89 |
+
| | date | group_by | order_by | ratio | join | where |
|
90 |
+
| -------------- | ---- | -------- | -------- | ----- | ---- | ----- |
|
91 |
+
| sqlcoder-70b | 96 | 91.4 | 97.1 | 85.7 | 97.1 | 91.4 |
|
92 |
+
| sqlcoder-7b-2 | 96 | 91.4 | 94.3 | 91.4 | 94.3 | 77.1 |
|
93 |
+
| sqlcoder-34b | 80 | 94.3 | 85.7 | 77.1 | 85.7 | 80 |
|
94 |
+
| gpt-4 | 72 | 94.3 | 97.1 | 80 | 91.4 | 80 |
|
95 |
+
| gpt-4-turbo | 76 | 91.4 | 91.4 | 62.8 | 88.6 | 77.1 |
|
96 |
+
| natural-sql-7b | 56 | 88.6 | 85.7 | 60 | 88.6 | 80 |
|
97 |
+
| sqlcoder-7b | 64 | 82.9 | 74.3 | 54.3 | 74.3 | 74.3 |
|
98 |
+
| gpt-3.5 | 72 | 77.1 | 82.8 | 34.3 | 65.7 | 71.4 |
|
99 |
+
| claude-2 | 52 | 71.4 | 74.3 | 57.1 | 65.7 | 62.9 |
|
100 |
+
|
101 |
+
## Model Card Contact
|
102 |
+
|
103 |
+
Contact us on X at [@defogdata](https://twitter.com/defogdata), or on email at [[email protected]](mailto:[email protected])
|
104 |
+
|