Text Generation
Transformers
PyTorch
English
sql
mysql
transformer
gpt
from-scratch
nl2sql
natural-language-to-sql
query-generation
Instructions to use karthik-2905/nl2sql-pretrained with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use karthik-2905/nl2sql-pretrained with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="karthik-2905/nl2sql-pretrained")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("karthik-2905/nl2sql-pretrained", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use karthik-2905/nl2sql-pretrained with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "karthik-2905/nl2sql-pretrained" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "karthik-2905/nl2sql-pretrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/karthik-2905/nl2sql-pretrained
- SGLang
How to use karthik-2905/nl2sql-pretrained 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 "karthik-2905/nl2sql-pretrained" \ --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": "karthik-2905/nl2sql-pretrained", "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 "karthik-2905/nl2sql-pretrained" \ --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": "karthik-2905/nl2sql-pretrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use karthik-2905/nl2sql-pretrained with Docker Model Runner:
docker model run hf.co/karthik-2905/nl2sql-pretrained
| { | |
| "model_name": "MySQL Query Generator From Scratch", | |
| "version": "1.0.0", | |
| "architecture": { | |
| "type": "GPT-style Transformer", | |
| "variant": "Decoder-only", | |
| "trained_from": "absolute_scratch", | |
| "no_pretrained_weights": true, | |
| "layers": { | |
| "total_transformer_blocks": 8, | |
| "attention_heads_per_layer": 8, | |
| "hidden_size": 512, | |
| "feedforward_size": 2048, | |
| "max_sequence_length": 512, | |
| "dropout_rate": 0.1 | |
| }, | |
| "components": { | |
| "token_embedding": "4206 x 512", | |
| "position_embedding": "512 x 512", | |
| "multi_head_attention": "Custom implementation", | |
| "feed_forward": "GELU activation", | |
| "layer_norm": "Pre-norm configuration", | |
| "output_projection": "512 x 4206" | |
| } | |
| }, | |
| "parameters": { | |
| "total_parameters": 29789184, | |
| "trainable_parameters": 29789184, | |
| "embedding_parameters": 2415616, | |
| "transformer_parameters": 27373568, | |
| "model_size_mb": 113.63671875 | |
| }, | |
| "vocabulary": { | |
| "total_tokens": 4206, | |
| "special_tokens": 4, | |
| "sql_keywords": "SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, LIMIT, etc.", | |
| "tokenization": "Custom word-level tokenizer", | |
| "built_from_scratch": true | |
| } | |
| } |