Text Generation
Transformers
Safetensors
English
phi3
text2sql
causal-lm
conversational
custom_code
text-generation-inference
Phi-3 Text-to-SQL Model
This is a fine-tuned Microsoft Phi-3 model specialized for Text-to-SQL generation.
Example
from transformers import AutoModelForCausalLM, AutoTokenizer
repo_id = "bhavika24/text2sql"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForCausalLM.from_pretrained(repo_id, torch_dtype="auto", device_map="auto")
question = "List all customers who ordered products over $500 last month."
inputs = tokenizer(question, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=128)
sql_query = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(sql_query)
- Downloads last month
- 2
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "bhavika24/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": "bhavika24/text2sql", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'