Instructions to use llmware/slim-sql-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use llmware/slim-sql-onnx with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="llmware/slim-sql-onnx")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("llmware/slim-sql-onnx") model = AutoModelForCausalLM.from_pretrained("llmware/slim-sql-onnx") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use llmware/slim-sql-onnx with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "llmware/slim-sql-onnx" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "llmware/slim-sql-onnx", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/llmware/slim-sql-onnx
- SGLang
How to use llmware/slim-sql-onnx 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 "llmware/slim-sql-onnx" \ --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": "llmware/slim-sql-onnx", "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 "llmware/slim-sql-onnx" \ --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": "llmware/slim-sql-onnx", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use llmware/slim-sql-onnx with Docker Model Runner:
docker model run hf.co/llmware/slim-sql-onnx
File size: 4,919 Bytes
68614a0 f0eef42 68614a0 f0eef42 68614a0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | {
"_name_or_path": "llmware/slim-sql-onnx",
"aib_version": "",
"architectures": [
"LlamaForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 1,
"eos_token_id": 2,
"hidden_act": "silu",
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": 5632,
"max_position_embeddings": 2048,
"mlp_bias": false,
"model_type": "llama",
"num_attention_heads": 32,
"num_hidden_layers": 22,
"num_key_value_heads": 4,
"pretraining_tp": 1,
"rms_norm_eps": 1e-05,
"rope_scaling": null,
"rope_theta": 10000.0,
"tie_word_embeddings": false,
"trained": "custom training",
"training_dataset": "",
"transformers_version": "4.41.2",
"use_cache": true,
"vocab_size": 32000,
"prompt_wrapper": "human_bot",
"description": "slim-sql is a text-to-sql model.",
"prompt_format": "<human> {table_schema} \n {question} \n<bot>:",
"output_format": "{sql}",
"tokenizer_local": "tokenizer_tl.json",
"tokenizer_config": {"bos_id":[1], "bos_token":["<s>"], "eos_id":[2],"eos_token":["</s>"]},
"model_parent": "llmware/slim-sql-1b-v0",
"description": "Text-to-SQL model from llmware - finetuned on tiny-llama - 1.1 parameter base",
"quantization": "int4",
"model_family": "ONNXGenerativeModel",
"parameters": 1.1,
"primary_keys": ["sql"],
"output_values": ["{{sql statement}}"],
"publisher": "llmware",
"release_date": "september 2024",
"function_call": "sql",
"test_params": ["sql"],
"test_set": [
{
"context": "CREATE TABLE customers (customer_name text, account_number integer,customer_level text, vip_customer text, annual_spend text, user_name text)",
"query": "Which customers are VIP customers?",
"answer": "SELECT * FROM customers WHERE vip_customer='yes'"
},
{
"context": "CREATE TABLE customers (customer_name text, account_number integer,customer_level text, vip_customer text, annual_spend text, user_name text)",
"query": "What is the annual spend for customer Rachel Michaels?",
"answer": "SELECT annual_spend FROM customers WHERE customer_name='Rachel Michaels'"
},
{
"context": "CREATE TABLE customers (customer_name text, account_number integer,customer_level text, vip_customer text, annual_spend text, user_name text)",
"query": "How many customers spend more than $1000 per year?",
"answer": "SELECT COUNT(*) FROM customers WHERE annual_spend > $1000"
},
{
"context": "CREATE TABLE customers (customer_name text, account_number integer,customer_level text, vip_customer text, annual_spend text, user_name text)",
"query": "Who are the customers with gold customer level?",
"answer": "SELECT customer_name FROM customers WHERE customer_level = 'gold'"
},
{
"context": "CREATE TABLE customers (customer_name text, account_number integer,customer_level text, vip_customer text, annual_spend text, user_name text)",
"query": "Which customer has account number 9382035?",
"answer": "SELECT * FROM customers WHERE account_number = 9382035"
},
{
"context": "CREATE TABLE customers (customer_name text, account_number integer,customer_level text, vip_customer text, annual_spend text, user_name text)",
"query": "What is the account number of customer Susanna Jones?",
"answer": "SELECT account_number FROM customers WHERE customer_name='Susanna Jones'"
},
{
"context": "CREATE TABLE library (library_name text, unique_doc_id integer, documents integer, blocks integer, images integer, pages integer, tables integer, account_name text)",
"query": "How many pages are in the human resources library?",
"answer": "SELECT pages FROM library WHERE library_name = 'human resources'"
},
{
"context": "CREATE TABLE library (library_name text, unique_doc_id integer, documents integer, blocks integer, images integer, pages integer, tables integer, account_name text)",
"query": "Which libraries have more than 1000 images?",
"answer": "SELECT * FROM library WHERE images > 1000"
},
{
"context": "CREATE TABLE library (library_name text, unique_doc_id integer, documents integer, blocks integer, images integer, pages integer, tables integer, account_name text)",
"query": "How many blocks are in the finance library?",
"answer": "SELECT blocks FROM library WHERE library_name = 'finance library'"
},
{
"context": "CREATE TABLE library (library_name text, unique_doc_id integer, documents integer, blocks integer, images integer, pages integer, tables integer, account_name text)",
"query": "What is a list of all of the libraries?",
"answer": "SELECT * FROM library"
},
{
"context": "CREATE TABLE library (library_name text, unique_doc_id integer, documents integer, blocks integer, images integer, pages integer, tables integer, account_name text)",
"query": "Which library has unique_doc_id of 8329?",
"answer": "SELECT * FROM library WHERE unique_doc_id = 8329"
}
]
}
|