Instructions to use aryanntated/SmolLM-360M-text2sql with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aryanntated/SmolLM-360M-text2sql with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aryanntated/SmolLM-360M-text2sql") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("aryanntated/SmolLM-360M-text2sql") model = AutoModelForCausalLM.from_pretrained("aryanntated/SmolLM-360M-text2sql", 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 aryanntated/SmolLM-360M-text2sql with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aryanntated/SmolLM-360M-text2sql" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aryanntated/SmolLM-360M-text2sql", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/aryanntated/SmolLM-360M-text2sql
- SGLang
How to use aryanntated/SmolLM-360M-text2sql 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 "aryanntated/SmolLM-360M-text2sql" \ --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": "aryanntated/SmolLM-360M-text2sql", "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 "aryanntated/SmolLM-360M-text2sql" \ --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": "aryanntated/SmolLM-360M-text2sql", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use aryanntated/SmolLM-360M-text2sql with Docker Model Runner:
docker model run hf.co/aryanntated/SmolLM-360M-text2sql
Model Card for Model ID
Model Details
Model Description
SmolLM-360M-text2sql is a fine-tuned transformer model optimized for text-to-SQL generation tasks. The model takes natural language queries and converts them into SQL statements, enabling seamless database interactions through natural language. It was fine-tuned using the 🤗 Hugging Face Transformers library.
- Developed by: Aryann Tated
- Model type: Transformer-based model, fine-tuned for text-to-SQL translation
Uses
Direct Use
Convert natural language questions into SQL queries for querying databases. Build user-friendly database query systems in applications such as business intelligence dashboards and customer support tools.
Downstream Use [optional]
- Integration into conversational agents for querying structured datasets.
- Automating SQL generation in educational or enterprise settings.
Out-of-Scope Use
- Not intended for querying highly sensitive or confidential databases without proper safeguards.
- Should not be used without verifying the output SQL queries for accuracy and security.
How to Get Started with the Model
Use the code below to get started with the model.
from transformers import AutoModelForCausalLM, AutoTokenizer
Load model and tokenizer
model_name = "aryanntated/SmolLM-360M-text2sql" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name)
Example usage
input_query = "How many employees were hired in 2023?" inputs = tokenizer(input_query, return_tensors="pt") outputs = model.generate(**inputs)
Decode and print the SQL query
generated_sql = tokenizer.decode(outputs[0], skip_special_tokens=True) print(generated_sql)
Model Card Contact
Email at - aryann.k.tated@gmail.com
- Downloads last month
- 8