onekq's picture
Create README.md
4ee44b0 verified
|
raw
history blame
1.73 kB
---
base_model: onekq-ai/OneSQL-v0.1-Qwen-3B
tags:
- text-generation-inference
- transformers
- qwen2
- mlx
license: apache-2.0
language:
- en
---
# Introduction
This model is the MLX version of [OneSQL-v0.1-Qwen-3B](https://huggingface.co/onekq-ai/OneSQL-v0.1-Qwen-3B). It is made for Apple Silicon.
# Performances
The self-evaluation EX score of the original model is **43.35** (compared to **63.33** by the 32B model on the [BIRD leaderboard](https://bird-bench.github.io/).
The self-evaluation EX score of this MLX model is **38.20**.
# Quick start
To use this model, craft your prompt to start with your database schema in the form of **CREATE TABLE**, followed by your natural language query preceded by **--**.
Make sure your prompt ends with **SELECT** in order for the model to finish the query for you. There is no need to set other parameters like temperature or max token limit.
```python
from mlx_lm import load, generate
model, tokenizer = load(model="onekq-ai/OneSQL-v0.1-Qwen-3B-MLX-4bit")
prompt="""CREATE TABLE students (
id INTEGER PRIMARY KEY,
name TEXT,
age INTEGER,
grade TEXT
);
-- Find the three youngest students
SELECT """
response = generate(model, tokenizer, f"<|im_start|>system\nYou are a SQL expert. Return code only.<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n")
print(response)
```
The model response is the finished SQL query without **SELECT**
```sql
* FROM students ORDER BY age ASC LIMIT 3
```
# User Experience
Speed benchmark of this model is obtained on a MacBook Air with M1 processor and 8GB of RAM, the lower bound of Apple Silicon.
On average, it took **8.76** seconds to generate a SQL query at **16.7** characters per second.