Instructions to use Anikolte/Sql_Assist with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Anikolte/Sql_Assist with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Anikolte/Sql_Assist") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Anikolte/Sql_Assist") model = AutoModelForCausalLM.from_pretrained("Anikolte/Sql_Assist", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Anikolte/Sql_Assist with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Anikolte/Sql_Assist" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Anikolte/Sql_Assist", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Anikolte/Sql_Assist
- SGLang
How to use Anikolte/Sql_Assist 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 "Anikolte/Sql_Assist" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Anikolte/Sql_Assist", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Anikolte/Sql_Assist" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Anikolte/Sql_Assist", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Anikolte/Sql_Assist with Docker Model Runner:
docker model run hf.co/Anikolte/Sql_Assist
SQL-Assist
SQL-Assist is a lightweight, high-efficiency language model fine-tuned from Qwen/Qwen2.5-0.5B-Instruct. It translates natural language database prompts into executable SQL statements along with step-by-step query explanations, taking database schemas into context.
The adapter weights were trained using Low-Rank Adaptation (LoRA) and subsequently merged back into the full base model, enabling direct inference through Hugging Face transformers without needing additional PEFT wrapper dependencies.
Model Details
Model Description
- Developed by: Anikolte
- Model type: Causal Language Model (Fine-tuned & Merged)
- Language(s) (NLP): English
- License: Apache-2.0
- Finetuned from model: Qwen/Qwen2.5-0.5B-Instruct
Model Sources
- Repository: Anikolte/Sql_Assist
Uses
Direct Use
SQL-Assist is intended to take natural language text queries along with an optional or explicit database schema context and produce standard SQL code alongside a plain-language technical explanation of the generated query.
Out-of-Scope Use
- Automatic execution of unvalidated DDL/DML queries on production database systems without human oversight.
- General non-database conversation or multi-turn non-technical chat.
Bias, Risks, and Limitations
- Context Window Limitation: The sequence length was truncated to
128tokens during fine-tuning. Database schemas or queries exceeding this token limit might get truncated or lose structural context during generation. - SQL Dialect Scope: Outputs default primarily to standard ANSI SQL and SQLite syntax styles present in the training dataset distribution.
Recommendations
Users are strongly recommended to inspect generated SQL queries prior to running them against live production databases to prevent accidental data modification or query syntax errors.
How to Get Started with the Model
Since the adapter weights have been merged into the base architecture, you can load and run inference directly using transformers:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "Anikolte/Sql_Assist"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
prompt = "Find the top 5 customers by total spending in 2023."
context = "CREATE TABLE orders (customer_id INT, amount FLOAT, order_date DATE);"
input_text = f"{prompt}\n{context}\n"
inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=150)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 35