Text Generation
Transformers
PyTorch
Safetensors
JAX
English
llama
sql
code
text2sql
instruction_tuned
basemodel
text-generation-inference
conversational
Instructions to use PipableAI/pip-sql-1.3b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PipableAI/pip-sql-1.3b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PipableAI/pip-sql-1.3b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("PipableAI/pip-sql-1.3b") model = AutoModelForCausalLM.from_pretrained("PipableAI/pip-sql-1.3b") 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
- vLLM
How to use PipableAI/pip-sql-1.3b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PipableAI/pip-sql-1.3b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PipableAI/pip-sql-1.3b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PipableAI/pip-sql-1.3b
- SGLang
How to use PipableAI/pip-sql-1.3b 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 "PipableAI/pip-sql-1.3b" \ --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": "PipableAI/pip-sql-1.3b", "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 "PipableAI/pip-sql-1.3b" \ --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": "PipableAI/pip-sql-1.3b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PipableAI/pip-sql-1.3b with Docker Model Runner:
docker model run hf.co/PipableAI/pip-sql-1.3b
Update README.md
Browse files
README.md
CHANGED
|
@@ -109,4 +109,81 @@ tokenizer = AutoTokenizer.from_pretrained("PipableAI/pipSQL-1.3b")
|
|
| 109 |
inputs = tokenizer(text, return_tensors="pt")
|
| 110 |
outputs = model.generate(**inputs, max_new_tokens=200)
|
| 111 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True).split('<sql>')[1].split('</sql>')[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
```
|
|
|
|
| 109 |
inputs = tokenizer(text, return_tensors="pt")
|
| 110 |
outputs = model.generate(**inputs, max_new_tokens=200)
|
| 111 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True).split('<sql>')[1].split('</sql>')[0])
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
## Examples
|
| 115 |
+
|
| 116 |
+
### Schema
|
| 117 |
+
```sql
|
| 118 |
+
CREATE TABLE Products (
|
| 119 |
+
product_id number,
|
| 120 |
+
parent_product_id number,
|
| 121 |
+
product_name text,
|
| 122 |
+
product_price number,
|
| 123 |
+
product_color text,
|
| 124 |
+
product_size text,
|
| 125 |
+
product_description text);
|
| 126 |
+
|
| 127 |
+
CREATE TABLE Customers (
|
| 128 |
+
customer_id number,
|
| 129 |
+
gender_code text,
|
| 130 |
+
customer_first_name text,
|
| 131 |
+
customer_middle_initial text,
|
| 132 |
+
customer_last_name text,
|
| 133 |
+
email_address text,
|
| 134 |
+
login_name text,
|
| 135 |
+
login_password text,
|
| 136 |
+
phone_number text,
|
| 137 |
+
address_line_1 text,
|
| 138 |
+
town_city text,
|
| 139 |
+
county text,
|
| 140 |
+
country text);
|
| 141 |
+
|
| 142 |
+
CREATE TABLE Customer_Payment_Methods (
|
| 143 |
+
customer_id number,
|
| 144 |
+
payment_method_code text);
|
| 145 |
+
|
| 146 |
+
CREATE TABLE Invoices (
|
| 147 |
+
invoice_number number,
|
| 148 |
+
invoice_status_code text,
|
| 149 |
+
invoice_date time);
|
| 150 |
+
|
| 151 |
+
CREATE TABLE Orders (
|
| 152 |
+
order_id number,
|
| 153 |
+
customer_id number,
|
| 154 |
+
order_status_code text,
|
| 155 |
+
date_order_placed time);
|
| 156 |
+
|
| 157 |
+
CREATE TABLE Order_Items (
|
| 158 |
+
order_item_id number,
|
| 159 |
+
product_id number,
|
| 160 |
+
order_id number,
|
| 161 |
+
order_item_status_code text);
|
| 162 |
+
|
| 163 |
+
CREATE TABLE Shipments (
|
| 164 |
+
shipment_id number,
|
| 165 |
+
order_id number,
|
| 166 |
+
invoice_number number,
|
| 167 |
+
shipment_tracking_number text,
|
| 168 |
+
shipment_date time);
|
| 169 |
+
|
| 170 |
+
CREATE TABLE Shipment_Items (
|
| 171 |
+
shipment_id number,
|
| 172 |
+
order_item_id number);
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
### Questions
|
| 176 |
+
What is the most popular payment method?
|
| 177 |
+
```sql
|
| 178 |
+
SELECT payment_method_code FROM Customer_Payment_Methods GROUP BY payment_method_code ORDER BY count(*) DESC LIMIT 1;
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
What are the product price and the product size of the products whose price is above average?
|
| 182 |
+
```sql
|
| 183 |
+
SELECT product_price , product_size FROM products WHERE product_price > (SELECT avg(product_price) FROM products)
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
What is the most uncommon order status?
|
| 187 |
+
```sql
|
| 188 |
+
SELECT order_status_code FROM orders GROUP BY order_status_code ORDER BY count(*) ASC LIMIT 1;
|
| 189 |
```
|