Instructions to use Hugo991/SQLBuilder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Hugo991/SQLBuilder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Hugo991/SQLBuilder") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Hugo991/SQLBuilder") model = AutoModelForCausalLM.from_pretrained("Hugo991/SQLBuilder", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Hugo991/SQLBuilder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Hugo991/SQLBuilder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Hugo991/SQLBuilder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Hugo991/SQLBuilder
- SGLang
How to use Hugo991/SQLBuilder 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 "Hugo991/SQLBuilder" \ --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": "Hugo991/SQLBuilder", "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 "Hugo991/SQLBuilder" \ --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": "Hugo991/SQLBuilder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Hugo991/SQLBuilder with Docker Model Runner:
docker model run hf.co/Hugo991/SQLBuilder
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 "Hugo991/SQLBuilder" \
--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": "Hugo991/SQLBuilder",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'Modรจle Text-to-SQL โ Version Strict + Fine-Tuning Personnalisรฉ
Ce modรจle est une version amรฉliorรฉe de Ellbendls/Qwen-3-4b-Text_to_SQL (Apache-2.0).
Il inclut :
โ un prรฉ-prompt intรฉgrรฉ โDiscipline SQLโ,
โ un lรฉger fine-tuning sur un dataset interne spรฉcialisรฉ,
โ un packaging propre pour un usage en production.
Lโobjectif est de fournir une gรฉnรฉration SQL fiable, stricte, reproductible et mieux alignรฉe sur les besoins mรฉtier spรฉcifiques du cas dโusage ciblรฉ.
๐ง Description du modรจle
Ce modรจle transforme des instructions en langage naturel en requรชtes SQL standardisรฉes.
La version originale a รฉtรฉ amรฉliorรฉe sur deux axes :
1) Discipline SQL intรฉgrรฉe dans le generation_config.json
Elle impose :
- sortie UNIQUEMENT SQL
- format propre et cohรฉrent
- alias systรฉmatiques dans les jointures
- liste explicite des colonnes
- sรฉlection de toutes les colonnes seulement si lโutilisateur le demande explicitement
- pas dโinvention de tables ou colonnes
2) Fine-tuning lรฉger basรฉ sur un dataset interne
Ce fine-tuning ajoute :
- de nouveaux schรฉmas de base de donnรฉes
- des requรชtes mรฉtiers typiques
- un style de SQL homogรจne
- de meilleures performances sur un domaine prรฉcis
Ce fine-tuning (LoRA ou QLoRA) permet dโadapter finement le comportement du modรจle sans nรฉcessiter un entraรฎnement complet.
๐ Caractรฉristiques clรฉs
โ Conversion texte โ SQL fiable
Gรฉnรฉration de requรชtes SQL propres, correctes et adaptรฉes aux schรฉmas ciblรฉs.
โ Standardisation stricte, mais flexible
Le modรจle รฉvite SELECT * ร moins que lโutilisateur demande explicitement โtoutes les colonnesโ.
โ Alignรฉ sur ton domaine mรฉtier
Grรขce au fine-tune interne, les requรชtes sont plus pertinentes et contextualisรฉes.
โ Multilingue
Fonctionne en franรงais, anglais, espagnol, portugais, allemand, chinois, etc.
โ Fenรชtre de contexte รฉtendue
Adaptรฉ aux grandes bases, requรชtes complexes, longues dรฉfinitions de tables.
๐งฉ Exemple de prompt interne intรฉgrรฉ
Le prรฉ-prompt utilisรฉ dans cette version :
You are a strict SQL generation engine. Your only task is to convert natural language instructions into valid SQL queries. Rules: 1. Output ONLY SQL. No explanations, no comments. 2. Always generate syntactically correct SQL. 3. Never invent tables or columns. 4. Avoid SELECT * unless the user explicitly requests all columns. 5. Use explicit column lists by default. 6. Use clear table aliases when joins are present. 7. Keep formatting clean and standardized.
๐ Exemple dโutilisation
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "Hugo991/SQLBuilder"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
user_input = "Montre-moi tous les dรฉpartements avec leur identifiant."
# On rรฉcupรจre le template intรฉgrรฉ dans le generation_config
template = tokenizer.generation_config.prompt_template
prompt = template.replace("{input}", user_input)
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 14
Model tree for Hugo991/SQLBuilder
Base model
Qwen/Qwen3-4B-Instruct-2507
Install from pip and serve model
# Install SGLang from pip: pip install sglang# Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Hugo991/SQLBuilder" \ --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": "Hugo991/SQLBuilder", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'