Instructions to use GPTpasta/qwen2.5-1.5b-text2sql-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use GPTpasta/qwen2.5-1.5b-text2sql-lora with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M # Run inference directly in the terminal: llama cli -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M # Run inference directly in the terminal: llama cli -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
Use Docker
docker model run hf.co/GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use GPTpasta/qwen2.5-1.5b-text2sql-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GPTpasta/qwen2.5-1.5b-text2sql-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GPTpasta/qwen2.5-1.5b-text2sql-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
- Ollama
How to use GPTpasta/qwen2.5-1.5b-text2sql-lora with Ollama:
ollama run hf.co/GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
- Unsloth Desktop
- Pi
How to use GPTpasta/qwen2.5-1.5b-text2sql-lora with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use GPTpasta/qwen2.5-1.5b-text2sql-lora with Docker Model Runner:
docker model run hf.co/GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
- Lemonade
How to use GPTpasta/qwen2.5-1.5b-text2sql-lora with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
Run and chat with the model
lemonade run user.qwen2.5-1.5b-text2sql-lora-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use GPTpasta/qwen2.5-1.5b-text2sql-lora with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use GPTpasta/qwen2.5-1.5b-text2sql-lora with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "GPTpasta/qwen2.5-1.5b-text2sql-lora:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Qwen2.5-1.5B Text-to-SQL (QLoRA & GGUF Q4_K_M)
This repository provides a lightweight Text-to-SQL model based on Qwen/Qwen2.5-1.5B-Instruct, fine-tuned using QLoRA on an 8GB NVIDIA GeForce RTX 4060 Laptop GPU, and quantized to GGUF Q4_K_M for CPU inference via llama.cpp.
Model Highlights
- Base Architecture:
Qwen/Qwen2.5-1.5B-Instruct(1.54B parameters) - Quantized GGUF Size: 934.7 MB (Q4_K_M, 5.08 BPW)
- CPU Inference Speed: 262 tokens/sec prompt eval, 21.9 tokens/sec generation (~45.6 ms/token on 4 CPU threads)
- Safety Guard: Built-in SQL parser ensuring queries are strictly single read-only
SELECT/WITHstatements (blocksDROP,DELETE,UPDATE,INSERT, multiple statements, and administrative pragmas).
Benchmark & Empirical Findings
Evaluated on the full Spider dev benchmark (1,034 complex multi-table queries):
| Configuration | Execution Accuracy | Valid-SQL Rate | Memory Footprint |
|---|---|---|---|
| Qwen2.5-1.5B-Instruct (Base, 4-bit) | 45.65% (472/1034) | 71.66% (741/1034) | ~2.2 GB VRAM |
+ QLoRA Fine-Tune (b-mc2/sql-create-context) |
15.76% (163/1034) | 49.71% (514/1034) | ~3.1 GB VRAM |
| GGUF Q4_K_M (CPU) | Matched fp16 | Matched fp16 | < 1.2 GB RAM |
The Value of Honest ML Engineering (Cross-Dataset Negative Transfer)
Fine-tuning on 20,000 samples from b-mc2/sql-create-context caused domain shift on multi-table relational benchmarks like Spider:
sql-create-contextprimarily consists of WikiSQL single-table synthetic schemas.- While the adapter successfully learned to enforce markdown-free raw SQL formatting, it overfitted to synthetic
T1/T2alias conventions, causing alias misattribution on multi-table DDL schemas. - For full error taxonomy, failure cases, and mitigation strategies, see
docs/error_analysis.md.
Quickstart
1. Python (Transformers + PEFT)
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_id = "Qwen/Qwen2.5-1.5B-Instruct"
adapter_id = "your-username/qwen2.5-1.5b-text2sql-lora"
tokenizer = AutoTokenizer.from_pretrained(base_id)
model = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)
prompt = """<|im_start|>system
You are a careful SQL assistant. Given a database schema and a question, write one read-only SQL SELECT query that answers the question. Return only the SQL, with no explanation.<|im_end|>
<|im_start|>user
Schema:
CREATE TABLE employees (id INT, name TEXT, department TEXT, salary INT);
Question: Who earns the highest salary in the Engineering department?<|im_end|>
<|im_start|>assistant
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=128, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
2. llama.cpp (GGUF CPU Execution)
# Run locally with pure CPU on any computer (sub-1GB memory footprint)
./llama-cli -m model-Q4_K_M.gguf -p "Schema:\nCREATE TABLE employees (id INT, name TEXT, department TEXT, salary INT);\n\nQuestion: Who earns the highest salary in Engineering?" -n 64
- Downloads last month
- 69
4-bit