Downloads · 30 days
27
29% of all-time downloads
manuelaschrittwieser/Qwen2.5-SQL-Assistant-Full
Qwen2.5-SQL-Assistant-Full is a text generation model from manuelaschrittwieser. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Downloads · 30 days
27
29% of all-time downloads
All-time downloads
92
Public
Parameters
1.5B
3.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors3.1 GB · 99%
From the Hugging Face model README
Qwen2.5-SQL-Assistant-Full is a standalone fine-tuned Language Model optimized for Text-to-SQL generation.
This model represents the merged version of the SQL-Assistant-Prod adapter.
The LoRA adapters have been permanently folded into the base model weights,
meaning this model can be loaded directly with transformers, vLLM, TGI, or converted to GGUF for local use (Ollama) without requiring PEFT dependencies.
Because this is a merged model, usage is standard and simple. You do not need peft.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# 1. Load the Model (Standard Loading)
model_id = "manuelaschrittwieser/Qwen2.5-SQL-Assistant-Full"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.float16 # or float32 for CPU
)
# 2. Define Context & Question
schema = "CREATE TABLE employees (id INT, name VARCHAR, dept VARCHAR, salary INT)"
question = "Show me the top 3 earners in the Sales department."
# 3. Format Input (Chat Template)
messages = [
{"role": "system", "content": "You are a SQL expert."},
{"role": "user", "content": f"{schema}\nQuestion: {question}"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# 4. Generate
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=150)
# 5. Output
print(tokenizer.decode(outputs[0], skip_special_tokens=True).split("assistant")[-1].strip())
The model was evaluated using Normalized Exact Match Accuracy against a hold-out test set from the b-mc2/sql-create-context dataset.
| Metric | Score | Notes |
|---|---|---|
| Exact Match | ~78% | High fidelity to schema constraints. |
| Hallucination | < 1% | Rarely invents columns not present in the CREATE TABLE context. |
| Format | 100% | Consistently outputs raw SQL without conversational filler. |
Qwen/Qwen2.5-1.5B-Instructmerge_and_unload() via PEFT.CREATE TABLE statement in the prompt to function correctly.INSERT/UPDATE queries, it is primarily optimized for data retrieval (SELECT).This project is licensed under the MIT License.