Instructions to use NumbersStation/nsql-llama-2-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NumbersStation/nsql-llama-2-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NumbersStation/nsql-llama-2-7B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NumbersStation/nsql-llama-2-7B") model = AutoModelForCausalLM.from_pretrained("NumbersStation/nsql-llama-2-7B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NumbersStation/nsql-llama-2-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NumbersStation/nsql-llama-2-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NumbersStation/nsql-llama-2-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/NumbersStation/nsql-llama-2-7B
- SGLang
How to use NumbersStation/nsql-llama-2-7B 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 "NumbersStation/nsql-llama-2-7B" \ --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": "NumbersStation/nsql-llama-2-7B", "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 "NumbersStation/nsql-llama-2-7B" \ --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": "NumbersStation/nsql-llama-2-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use NumbersStation/nsql-llama-2-7B with Docker Model Runner:
docker model run hf.co/NumbersStation/nsql-llama-2-7B
Update README.md
Browse files
README.md
CHANGED
|
@@ -41,7 +41,7 @@ NSQL-llama-2-7B was evaluated on the Spider benchmark, the standard academic eva
|
|
| 41 |
|
| 42 |
| Model | Size | Execution Accuracy | Matching Accuracy |
|
| 43 |
|-------|------|-------------------|-------------------|
|
| 44 |
-
| **NSQL-llama-2-7B** | 7B |
|
| 45 |
| GPT-4 | ~1.8T | 76.2% | 41.9% |
|
| 46 |
| GPT-3.5 Chat | — | 72.8% | 44.2% |
|
| 47 |
| Llama-2-7B (base) | 7B | 29.1% | 19.3% |
|
|
@@ -63,7 +63,7 @@ NSQL-llama-2-7B was evaluated on the Spider benchmark, the standard academic eva
|
|
| 63 |
|
| 64 |
2. **Matching Accuracy:** NSQL achieves 66.3% matching accuracy vs. GPT-4's 41.9% (+24.4 points), indicating more structurally correct SQL generation.
|
| 65 |
|
| 66 |
-
3. **Efficiency:** NSQL achieves near-parity with GPT-4 on overall execution (
|
| 67 |
|
| 68 |
4. **Local Deployment:** The 7B parameter size enables local deployment on commodity hardware, preserving data privacy.
|
| 69 |
|
|
@@ -92,7 +92,7 @@ On these complex query types, NSQL substantially outperforms GPT-4 while enablin
|
|
| 92 |
| NSQL-350M | 350M | 51.7% | 45.6% |
|
| 93 |
| NSQL-2B | 2B | 59.3% | 53.2% |
|
| 94 |
| NSQL-6B | 6B | 63.6% | 57.4% |
|
| 95 |
-
| **NSQL-llama-2-7B** | **7B** | **
|
| 96 |
|
| 97 |
---
|
| 98 |
|
|
|
|
| 41 |
|
| 42 |
| Model | Size | Execution Accuracy | Matching Accuracy |
|
| 43 |
|-------|------|-------------------|-------------------|
|
| 44 |
+
| **NSQL-llama-2-7B** | 7B | 78.1% | **66.3%** |
|
| 45 |
| GPT-4 | ~1.8T | 76.2% | 41.9% |
|
| 46 |
| GPT-3.5 Chat | — | 72.8% | 44.2% |
|
| 47 |
| Llama-2-7B (base) | 7B | 29.1% | 19.3% |
|
|
|
|
| 63 |
|
| 64 |
2. **Matching Accuracy:** NSQL achieves 66.3% matching accuracy vs. GPT-4's 41.9% (+24.4 points), indicating more structurally correct SQL generation.
|
| 65 |
|
| 66 |
+
3. **Efficiency:** NSQL achieves near-parity with GPT-4 on overall execution (78.10% vs 76.2%) while being ~250× smaller.
|
| 67 |
|
| 68 |
4. **Local Deployment:** The 7B parameter size enables local deployment on commodity hardware, preserving data privacy.
|
| 69 |
|
|
|
|
| 92 |
| NSQL-350M | 350M | 51.7% | 45.6% |
|
| 93 |
| NSQL-2B | 2B | 59.3% | 53.2% |
|
| 94 |
| NSQL-6B | 6B | 63.6% | 57.4% |
|
| 95 |
+
| **NSQL-llama-2-7B** | **7B** | **78.1%** | **66.3%** |
|
| 96 |
|
| 97 |
---
|
| 98 |
|