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") - Inference
- 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
Reproducing Spider Eval scores
Hi,
I've been trying to reproduce the results as shown in the blog but I haven't been able to get any close to the scores mentioned based on the official test-suite for sql-eval(https://github.com/taoyds/test-suite-sql-eval), to my surprise when I went to look at the results on the Spider dev set, it seemed like the model had around 190 response incomplete and the score coming as 0.509 for execution, instead of 0.75.
So, I wanted to know if I'm doing anything wrong. Currently, I'm simply using model.generate without any extra parameters except max_length of 500 passed (Greedy Search). Are there any generation parameters I need to look at or is there any evaluation scripts open-sourced that I can make use of?
Thanks in advance.
Please use torch.float16 or torch.bfloat16 and set max_new_tokens greater than 300 tokens. The incomplete response might be because 1) different dtype 2) not enough max_new_token.
For what it's worth, I had the same experience of trying to reproduce the reported Spider benchmark scores and finding that the score I got was much lower than advertised.
There are some examples in their github repo, but I still found low scores even after being careful to follow the examples exactly: https://github.com/NumbersStationAI/NSQL/tree/main/examples.
For what it's worth, I had the same experience of trying to reproduce the reported Spider benchmark scores and finding that the score I got was much lower than advertised.
@djm2131 I remember facing the same issue even after setting the dtype to torch.bfloat16 and max_new_tokens to 400. I got somewhere around 0.647.
Thanks for your interest in our work!
Here are three things:
- The model works best with
torch.bfloat16. - Please give enough
max_new_tokensuch as 500. - Please use the code from the official github and the database schema from the dataset instead of the database schema.
Please let us know if you still have issues.