Instructions to use defog/sqlcoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use defog/sqlcoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="defog/sqlcoder")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("defog/sqlcoder") model = AutoModelForCausalLM.from_pretrained("defog/sqlcoder") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use defog/sqlcoder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "defog/sqlcoder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "defog/sqlcoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/defog/sqlcoder
- SGLang
How to use defog/sqlcoder with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "defog/sqlcoder" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "defog/sqlcoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "defog/sqlcoder" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "defog/sqlcoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use defog/sqlcoder with Docker Model Runner:
docker model run hf.co/defog/sqlcoder
Wendy commited on
Commit ·
4cb94f8
1
Parent(s): 5482a98
Slight corrections in README
Browse files
README.md
CHANGED
|
@@ -11,7 +11,7 @@ tags:
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# Defog SQLCoder
|
| 14 |
-
Defog's SQLCoder is a state
|
| 15 |
|
| 16 |
[🤗 HF Repo](https://huggingface.co/defog/sqlcoder) | [♾️ Colab](https://drive.google.com/file/d/13BIKsqHnPOBcQ-ba2p77L5saiepTIwu0/view?usp=sharing) | [🐦 Twitter](https://twitter.com/defogdata)
|
| 17 |
|
|
@@ -36,10 +36,10 @@ Defog was trained on 10,537 human-curated questions across 2 epochs. These quest
|
|
| 36 |
|
| 37 |
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. You can read more about the dataset creation and classification process [here](https://defog.ai/blog/defog-sqlcoder-dataset-creation).
|
| 38 |
|
| 39 |
-
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
|
| 40 |
|
| 41 |
## Results by question category
|
| 42 |
-
We classified each generated question into one of 5 categories.
|
| 43 |
| query_category | gpt-4 | defog-sqlcoder | gpt-3.5-turbo | defog-easy | text-davinci-003 | wizard-coder | star-coder |
|
| 44 |
|-|-|-|-|-|-|-|-|
|
| 45 |
| group_by | 82.9 | 77.1 | 71.4 | 62.9 | 62.9 | 68.6 | 54.3 |
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# Defog SQLCoder
|
| 14 |
+
Defog's SQLCoder is a state-of-the-art LLM for converting natural language questions to SQL queries.
|
| 15 |
|
| 16 |
[🤗 HF Repo](https://huggingface.co/defog/sqlcoder) | [♾️ Colab](https://drive.google.com/file/d/13BIKsqHnPOBcQ-ba2p77L5saiepTIwu0/view?usp=sharing) | [🐦 Twitter](https://twitter.com/defogdata)
|
| 17 |
|
|
|
|
| 36 |
|
| 37 |
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. You can read more about the dataset creation and classification process [here](https://defog.ai/blog/defog-sqlcoder-dataset-creation).
|
| 38 |
|
| 39 |
+
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.
|
| 40 |
|
| 41 |
## Results by question category
|
| 42 |
+
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.
|
| 43 |
| query_category | gpt-4 | defog-sqlcoder | gpt-3.5-turbo | defog-easy | text-davinci-003 | wizard-coder | star-coder |
|
| 44 |
|-|-|-|-|-|-|-|-|
|
| 45 |
| group_by | 82.9 | 77.1 | 71.4 | 62.9 | 62.9 | 68.6 | 54.3 |
|