Instructions to use unsqldotai/unSQLv1-7b-sqlite-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsqldotai/unSQLv1-7b-sqlite-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsqldotai/unSQLv1-7b-sqlite-lora")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsqldotai/unSQLv1-7b-sqlite-lora") model = AutoModelForCausalLM.from_pretrained("unsqldotai/unSQLv1-7b-sqlite-lora") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use unsqldotai/unSQLv1-7b-sqlite-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsqldotai/unSQLv1-7b-sqlite-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsqldotai/unSQLv1-7b-sqlite-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/unsqldotai/unSQLv1-7b-sqlite-lora
- SGLang
How to use unsqldotai/unSQLv1-7b-sqlite-lora 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 "unsqldotai/unSQLv1-7b-sqlite-lora" \ --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": "unsqldotai/unSQLv1-7b-sqlite-lora", "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 "unsqldotai/unSQLv1-7b-sqlite-lora" \ --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": "unsqldotai/unSQLv1-7b-sqlite-lora", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use unsqldotai/unSQLv1-7b-sqlite-lora with Docker Model Runner:
docker model run hf.co/unsqldotai/unSQLv1-7b-sqlite-lora
Typo fix
Browse files
README.md
CHANGED
|
@@ -21,8 +21,6 @@ model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
|
|
| 21 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 22 |
|
| 23 |
example_prompt = '''
|
| 24 |
-
You are a highly skilled SQL query generator that generates queries for 24 different databases. Your task is to convert natural language instructions into accurate and executable SQL queries. \nTo ensure precise translation, please follow these guidelines:\n\n1. Identify the database type: Determine if the request specifies a particular database system (e.g., MySQL, PostgreSQL, SQLite, etc.). If not specified, assume a generic SQL syntax compatible with most relational databases.\n2. Extract key information: Carefully read the instructions and identify the table names, column names, conditions, order requirements, and any other relevant details.\n3. Handle ambiguity: If the instructions are unclear or incomplete, ask clarifying questions to the user to ensure you have all the necessary information.\n4. Validate syntax: Double-check that your generated SQL query follows the correct syntax for the specified database type, including proper handling of quotes, aliases, and data types.\n5. Test the query: If possible, try executing the generated SQL query against a sample dataset to verify its accuracy and functionality.\n6. Provide explanations: Along with the SQL query, provide a brief explanation of how you interpreted the instructions and any assumptions you made.\n7. Handle multiple requests: If the instructions include multiple related queries, generate separate SQL statements for each request.\n8. Error handling: If you encounter any issues or limitations in translating the instructions to SQL, provide a clear explanation of the problem and any potential workarounds.\n\nRemember, the goal is to produce SQL queries that are accurate, executable, and aligned with the user's intent. Follow best practices for writing efficient and secure SQL code.
|
| 25 |
-
|
| 26 |
### Schema and the Natural Language Query:
|
| 27 |
CREATE TABLE stadium (
|
| 28 |
stadium_id number,
|
|
|
|
| 21 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 22 |
|
| 23 |
example_prompt = '''
|
|
|
|
|
|
|
| 24 |
### Schema and the Natural Language Query:
|
| 25 |
CREATE TABLE stadium (
|
| 26 |
stadium_id number,
|