Instructions to use QuantFactory/llama-3-sqlcoder-8b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use QuantFactory/llama-3-sqlcoder-8b-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/llama-3-sqlcoder-8b-GGUF", filename="llama-3-sqlcoder-8b.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/llama-3-sqlcoder-8b-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/llama-3-sqlcoder-8b-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/llama-3-sqlcoder-8b-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/llama-3-sqlcoder-8b-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
- Ollama
How to use QuantFactory/llama-3-sqlcoder-8b-GGUF with Ollama:
ollama run hf.co/QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/llama-3-sqlcoder-8b-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/llama-3-sqlcoder-8b-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/llama-3-sqlcoder-8b-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/llama-3-sqlcoder-8b-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/llama-3-sqlcoder-8b-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/llama-3-sqlcoder-8b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/llama-3-sqlcoder-8b-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.llama-3-sqlcoder-8b-GGUF-Q4_K_M
List all available models
lemonade list
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-sa-4.0
|
| 3 |
+
metrics:
|
| 4 |
+
- accuracy
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
tags:
|
| 7 |
+
- code
|
| 8 |
+
base_model: defog/llama-3-sqlcoder-8b
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# QuantFactory/llama-3-sqlcoder-8b-GGUF
|
| 12 |
+
This is quantized version of [defog/llama-3-sqlcoder-8b](https://huggingface.co/defog/llama-3-sqlcoder-8b) created using llama.cpp
|
| 13 |
+
|
| 14 |
+
## Model Description
|
| 15 |
+
|
| 16 |
+
A capable language model for text to SQL generation for Postgres, Redshift and Snowflake that is on-par with the most capable generalist frontier models.
|
| 17 |
+
|
| 18 |
+

|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
Developed by: Defog, Inc
|
| 22 |
+
Model type: [Text to SQL]
|
| 23 |
+
License: [CC-by-SA-4.0]
|
| 24 |
+
Finetuned from model: [Meta-Llama-3-8B-Instruct]
|
| 25 |
+
|
| 26 |
+
## Demo Page
|
| 27 |
+
[https://defog.ai/sqlcoder-demo/](https://defog.ai/sqlcoder-demo/)
|
| 28 |
+
|
| 29 |
+
## Ideal prompt and inference parameters
|
| 30 |
+
Set temperature to 0, and do not do sampling.
|
| 31 |
+
|
| 32 |
+
### Prompt
|
| 33 |
+
```
|
| 34 |
+
<|begin_of_text|><|start_header_id|>user<|end_header_id|>
|
| 35 |
+
|
| 36 |
+
Generate a SQL query to answer this question: `{user_question}`
|
| 37 |
+
{instructions}
|
| 38 |
+
|
| 39 |
+
DDL statements:
|
| 40 |
+
{create_table_statements}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
| 41 |
+
|
| 42 |
+
The following SQL query best answers the question `{user_question}`:
|
| 43 |
+
```sql
|
| 44 |
+
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Evaluation
|
| 48 |
+
This model was evaluated on SQL-Eval, a PostgreSQL based evaluation framework developed by Defog for testing and alignment of model capabilities.
|
| 49 |
+
|
| 50 |
+
You can read more about the methodology behind SQLEval [here](https://defog.ai/blog/open-sourcing-sqleval/).
|
| 51 |
+
|
| 52 |
+
## Contact defog
|
| 53 |
+
Contact defog on X at [@defogdata](https://twitter.com/defogdata), or on email at founders@defog.ai
|