Text Generation
PEFT
Safetensors
Transformers
English
llama
sql-generation
lora
unsloth
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use dhashu/sql-genie-full with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use dhashu/sql-genie-full with PEFT:
Task type is invalid.
- Transformers
How to use dhashu/sql-genie-full with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dhashu/sql-genie-full")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dhashu/sql-genie-full") model = AutoModelForCausalLM.from_pretrained("dhashu/sql-genie-full") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use dhashu/sql-genie-full with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dhashu/sql-genie-full" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dhashu/sql-genie-full", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/dhashu/sql-genie-full
- SGLang
How to use dhashu/sql-genie-full 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 "dhashu/sql-genie-full" \ --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": "dhashu/sql-genie-full", "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 "dhashu/sql-genie-full" \ --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": "dhashu/sql-genie-full", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Studio new
How to use dhashu/sql-genie-full 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 dhashu/sql-genie-full 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 dhashu/sql-genie-full to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for dhashu/sql-genie-full to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="dhashu/sql-genie-full", max_seq_length=2048, ) - Docker Model Runner
How to use dhashu/sql-genie-full with Docker Model Runner:
docker model run hf.co/dhashu/sql-genie-full
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
| 1 |
---
|
| 2 |
base_model: unsloth/meta-llama-3.1-8b-bnb-4bit
|
| 3 |
tags:
|
| 4 |
-
- text-generation
|
| 5 |
-
-
|
|
|
|
|
|
|
|
|
|
| 6 |
- unsloth
|
| 7 |
- llama
|
| 8 |
license: apache-2.0
|
|
@@ -10,12 +13,92 @@ language:
|
|
| 10 |
- en
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
| 16 |
-
- **License:** apache-2.0
|
| 17 |
-
- **Finetuned from model :** unsloth/meta-llama-3.1-8b-bnb-4bit
|
| 18 |
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
base_model: unsloth/meta-llama-3.1-8b-bnb-4bit
|
| 3 |
tags:
|
| 4 |
+
- text-generation
|
| 5 |
+
- sql-generation
|
| 6 |
+
- finetuning
|
| 7 |
+
- lora
|
| 8 |
+
- peft
|
| 9 |
- unsloth
|
| 10 |
- llama
|
| 11 |
license: apache-2.0
|
|
|
|
| 13 |
- en
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# SQL-Genie (LLaMA-3.1-8B Fine-Tuned)
|
| 17 |
|
| 18 |
+
## Model Overview
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
**SQL-Genie** is a fine-tuned version of **LLaMA-3.1-8B**, specialized for **natural language to SQL generation**.
|
| 21 |
+
The model was trained using **parameter-efficient fine-tuning (LoRA)** on a structured SQL instruction dataset, enabling accurate SQL query generation while keeping training and inference costs low.
|
| 22 |
|
| 23 |
+
- **Developed by:** dhashu
|
| 24 |
+
- **Base model:** `unsloth/meta-llama-3.1-8b-bnb-4bit`
|
| 25 |
+
- **License:** Apache-2.0
|
| 26 |
+
- **Training framework:** Unsloth + Hugging Face TRL
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## Training Methodology
|
| 31 |
+
|
| 32 |
+
This model was fine-tuned using **LoRA (Low-Rank Adaptation)** via the **PEFT** framework.
|
| 33 |
+
|
| 34 |
+
### Key Training Details
|
| 35 |
+
- Base model loaded in **4-bit quantization** for memory efficiency
|
| 36 |
+
- **LoRA adapters** applied to attention and feed-forward layers
|
| 37 |
+
- Base model weights remained **frozen**
|
| 38 |
+
- Only LoRA parameters were trained
|
| 39 |
+
- Training performed using **Supervised Fine-Tuning (SFT)**
|
| 40 |
+
|
| 41 |
+
This approach allows the model to learn SQL generation patterns efficiently without full model retraining.
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
## Dataset
|
| 46 |
+
|
| 47 |
+
The model was trained on a subset of the **`b-mc2/sql-create-context`** dataset, which contains:
|
| 48 |
+
- Natural language questions
|
| 49 |
+
- Database schema/context
|
| 50 |
+
- Corresponding SQL queries
|
| 51 |
+
|
| 52 |
+
Each sample was formatted as an instruction-style prompt to improve reasoning and output structure.
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## Performance & Efficiency
|
| 57 |
+
|
| 58 |
+
- 🚀 **2× faster fine-tuning** using **Unsloth**
|
| 59 |
+
- 💾 **Low VRAM usage** via 4-bit quantization
|
| 60 |
+
- 🧠 Improved schema understanding and SQL syntax generation
|
| 61 |
+
- ⚡ Suitable for real-time inference and lightweight deployments
|
| 62 |
+
|
| 63 |
+
---
|
| 64 |
+
|
| 65 |
+
## Model Variants
|
| 66 |
+
|
| 67 |
+
This repository may contain **either**:
|
| 68 |
+
|
| 69 |
+
### 🔹 LoRA Adapter Model
|
| 70 |
+
- Contains only LoRA weights
|
| 71 |
+
- Requires loading the base LLaMA-3.1-8B model
|
| 72 |
+
- Ideal for research and modular fine-tuning
|
| 73 |
+
|
| 74 |
+
### 🔹 Merged Model (if applicable)
|
| 75 |
+
- LoRA adapters merged into base weights
|
| 76 |
+
- No PEFT required at inference time
|
| 77 |
+
- Ready-to-use single checkpoint
|
| 78 |
+
|
| 79 |
+
(Check the repository files to confirm the variant.)
|
| 80 |
+
|
| 81 |
+
---
|
| 82 |
+
|
| 83 |
+
## Intended Use Cases
|
| 84 |
+
|
| 85 |
+
- Natural language → SQL query generation
|
| 86 |
+
- Database querying assistants
|
| 87 |
+
- AI-powered analytics tools
|
| 88 |
+
- Educational and research purposes
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## Limitations
|
| 93 |
+
|
| 94 |
+
- Trained on a limited SQL dataset subset
|
| 95 |
+
- Not guaranteed to generalize to all SQL dialects
|
| 96 |
+
- Should be validated before production database usage
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## Acknowledgements
|
| 101 |
+
|
| 102 |
+
This model was trained using **Unsloth**, enabling faster and more memory-efficient fine-tuning of large language models.
|
| 103 |
+
|
| 104 |
+
[](https://github.com/unslothai/unsloth)
|