Instructions to use InfometryINC/phi2-retail-sql-lora-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use InfometryINC/phi2-retail-sql-lora-v1 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("microsoft/phi-2") model = PeftModel.from_pretrained(base_model, "InfometryINC/phi2-retail-sql-lora-v1") - Transformers
How to use InfometryINC/phi2-retail-sql-lora-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="InfometryINC/phi2-retail-sql-lora-v1")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("InfometryINC/phi2-retail-sql-lora-v1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use InfometryINC/phi2-retail-sql-lora-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "InfometryINC/phi2-retail-sql-lora-v1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "InfometryINC/phi2-retail-sql-lora-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/InfometryINC/phi2-retail-sql-lora-v1
- SGLang
How to use InfometryINC/phi2-retail-sql-lora-v1 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 "InfometryINC/phi2-retail-sql-lora-v1" \ --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": "InfometryINC/phi2-retail-sql-lora-v1", "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 "InfometryINC/phi2-retail-sql-lora-v1" \ --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": "InfometryINC/phi2-retail-sql-lora-v1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use InfometryINC/phi2-retail-sql-lora-v1 with Docker Model Runner:
docker model run hf.co/InfometryINC/phi2-retail-sql-lora-v1
Commit History
-
Update README.md
AdminVerified signature8b2d912 -
Update README.md
AdminVerified signature7d811ee -
Upload 5 files
AdminVerified signature--- license: apache-2.0 base_model: microsoft/phi-2 tags: - text-generation - text-to-sql - lora - peft --- # Phi-2 Retail SQL LoRA (v2) ## Overview This model is a LoRA fine-tuned version of `microsoft/phi-2`, designed specifically for **Text-to-SQL generation** in retail and structured data environments. It converts natural language queries into accurate SQL statements using schema-aware prompting. --- ## Model Details - **Base Model:** microsoft/phi-2 - **Fine-tuning Method:** LoRA (Low-Rank Adaptation) - **Framework:** Transformers + PEFT - **Task:** Text-to-SQL generation - **Domain:** Retail datasets --- ## Training Approach The model was trained using instruction-style prompts: Schema: <database schema> Question: <natural language query> SQL: <expected SQL output> ``` Key characteristics: Schema-aware learning Structured output generation Optimized for query correctness Capabilities Generate SQL from natural language Handle structured schema inputs Suitable …c3fdf3c -
initial commit
AdminVerified signature017d807