mav23 commited on
Commit
4a8183e
·
verified ·
1 Parent(s): 366d0a8

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +68 -0
  3. sqlcoder.Q4_0.gguf +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ sqlcoder.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language:
4
+ - en
5
+ metrics:
6
+ - code_eval
7
+ library_name: transformers
8
+ pipeline_tag: text-generation
9
+ tags:
10
+ - code
11
+ inference: false
12
+ ---
13
+ # ARCHIVE NOTICE
14
+ This repository is now significantly outdated. You should use the repository at [sqlcoder-7b-2](https://huggingface.co/defog/sqlcoder-7b-2) instead. It is significantly better and consumes fewer GPU resources.
15
+
16
+ # Defog SQLCoder
17
+ Defog's SQLCoder is a state-of-the-art LLM for converting natural language questions to SQL queries.
18
+
19
+ [Interactive Demo](https://defog.ai/sqlcoder-demo) | [♾️ Colab](https://colab.research.google.com/drive/1z4rmOEiFkxkMiecAWeTUlPl0OmKgfEu7) | [🐦 Twitter](https://twitter.com/defogdata)
20
+
21
+ ## TL;DR
22
+ SQLCoder is a 15B parameter model that slightly outperforms `gpt-3.5-turbo` for natural language to SQL generation tasks on our [sql-eval](https://github.com/defog-ai/sql-eval) framework, and significantly outperforms all popular open-source models. It also significantly outperforms `text-davinci-003`, a model that's more than 10 times its size.
23
+
24
+ SQLCoder is fine-tuned on a base StarCoder model.
25
+
26
+ ## Results on novel datasets not seen in training
27
+ | model | perc_correct |
28
+ |-|-|
29
+ | gpt-4 | 74.3 |
30
+ | defog-sqlcoder | 64.6 |
31
+ | gpt-3.5-turbo | 60.6 |
32
+ | defog-easysql | 57.1 |
33
+ | text-davinci-003 | 54.3 |
34
+ | wizardcoder | 52.0 |
35
+ | starcoder | 45.1 |
36
+
37
+ ## License
38
+ The model weights have a `CC BY-SA 4.0` license, with OpenRAIL-M clauses for responsible use attached. The TL;DR is that you can use and modify the model for any purpose – including commercial use. However, if you modify the weights (for example, by fine-tuning), you must open-source your modified weights under the same `CC BY-SA 4.0` license terms.
39
+
40
+ ## Training
41
+ Defog was trained on 10,537 human-curated questions across 2 epochs. These questions were based on 10 different schemas. None of the schemas in the training data were included in our evaluation framework.
42
+
43
+ Training happened in 2 phases. The first phase was on questions that were classified as "easy" or "medium" difficulty, and the second phase was on questions that were classified as "hard" or "extra hard" difficulty.
44
+
45
+ The results of training on our easy+medium data were stored in a model called `defog-easy`. We found that the additional training on hard+extra-hard data led to a 7 percentage point increase in performance.
46
+
47
+ ## Results by question category
48
+ We classified each generated question into one of 5 categories. The table displays the percentage of questions answered correctly by each model, broken down by category.
49
+ | query_category | gpt-4 | defog-sqlcoder | gpt-3.5-turbo | defog-easy | text-davinci-003 | wizard-coder | star-coder |
50
+ |-|-|-|-|-|-|-|-|
51
+ | group_by | 82.9 | 77.1 | 71.4 | 62.9 | 62.9 | 68.6 | 54.3 |
52
+ | order_by | 71.4 | 65.7 | 60.0 | 68.6 | 60.0 | 54.3 | 57.1 |
53
+ | ratio | 62.9 | 57.1 | 48.6 | 40.0 | 37.1 | 22.9 | 17.1 |
54
+ | table_join | 74.3 | 57.1 | 60.0 | 54.3 | 51.4 | 54.3 | 51.4 |
55
+ | where | 80.0 | 65.7 | 62.9 | 60.0 | 60.0 | 60.0 | 45.7 |
56
+
57
+ ## Using SQLCoder
58
+ You can use SQLCoder via the `transformers` library by downloading our model weights from the HuggingFace repo. We have added sample code for inference [here](./inference.py). You can also use a demo on our website [here](https://defog.ai/sqlcoder-demo), or run SQLCoder in Colab [here](https://colab.research.google.com/drive/13BIKsqHnPOBcQ-ba2p77L5saiepTIwu0#scrollTo=ZpbVgVHMkJvC)
59
+
60
+ ## Hardware Requirements
61
+ SQLCoder has been tested on an A100 40GB GPU with `bfloat16` weights. You can also load an 8-bit quantized version of the model on consumer GPUs with 20GB or more of memory – like RTX 4090, RTX 3090, and Apple M2 Pro, M2 Max, or M2 Ultra Chips with 20GB or more of memory.
62
+
63
+ ## Todo
64
+
65
+ - [x] Open-source the v1 model weights
66
+ - [ ] Train the model on more data, with higher data variance
67
+ - [ ] Tune the model further with Reward Modelling and RLHF
68
+ - [ ] Pretrain a model from scratch that specializes in SQL analysis
sqlcoder.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:979674a4e3b4af337b7b26a1351c1de0b08b16324a36e07f0989a25dd9d76017
3
+ size 9160427296