Instructions to use gabrielpondc/NL2SQL-StarCoder-15B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gabrielpondc/NL2SQL-StarCoder-15B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gabrielpondc/NL2SQL-StarCoder-15B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("gabrielpondc/NL2SQL-StarCoder-15B") model = AutoModelForCausalLM.from_pretrained("gabrielpondc/NL2SQL-StarCoder-15B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gabrielpondc/NL2SQL-StarCoder-15B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gabrielpondc/NL2SQL-StarCoder-15B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gabrielpondc/NL2SQL-StarCoder-15B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/gabrielpondc/NL2SQL-StarCoder-15B
- SGLang
How to use gabrielpondc/NL2SQL-StarCoder-15B 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 "gabrielpondc/NL2SQL-StarCoder-15B" \ --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": "gabrielpondc/NL2SQL-StarCoder-15B", "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 "gabrielpondc/NL2SQL-StarCoder-15B" \ --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": "gabrielpondc/NL2SQL-StarCoder-15B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use gabrielpondc/NL2SQL-StarCoder-15B with Docker Model Runner:
docker model run hf.co/gabrielpondc/NL2SQL-StarCoder-15B
Update README.md
Browse files
README.md
CHANGED
|
@@ -43,6 +43,30 @@ CREATE TABLE "table_name" (
|
|
| 43 |
"""
|
| 44 |
```
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
## Quick Start
|
| 47 |
|
| 48 |
```python
|
|
|
|
| 43 |
"""
|
| 44 |
```
|
| 45 |
|
| 46 |
+
But from test we recomended using the promt what sqlcoder was given:
|
| 47 |
+
|
| 48 |
+
```
|
| 49 |
+
### Instructions:
|
| 50 |
+
Your task is to convert a question into a SQL query, given a Postgres database schema.
|
| 51 |
+
Adhere to these rules:
|
| 52 |
+
- **Deliberately go through the question and database schema word by word** to appropriately answer the question
|
| 53 |
+
- **Use Table Aliases** to prevent ambiguity. For example, `SELECT table1.col1, table2.col1 FROM table1 JOIN table2 ON table1.id = table2.id`.
|
| 54 |
+
- When creating a ratio, always cast the numerator as float
|
| 55 |
+
### Input:
|
| 56 |
+
Generate a SQL query that answers the question `{question}`.
|
| 57 |
+
This query will run on a database whose schema is represented in this string:
|
| 58 |
+
CREATE TABLE "table_name" (
|
| 59 |
+
"col1" int,
|
| 60 |
+
...
|
| 61 |
+
...
|
| 62 |
+
)
|
| 63 |
+
### Response:
|
| 64 |
+
Based on your instructions, here is the SQL query I have generated to answer the question `{question}`:
|
| 65 |
+
```sql
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
## Quick Start
|
| 71 |
|
| 72 |
```python
|