Instructions to use funkaya1234/wikisql-qwen2.5-coder-qlora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use funkaya1234/wikisql-qwen2.5-coder-qlora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-3B-Instruct") model = PeftModel.from_pretrained(base_model, "funkaya1234/wikisql-qwen2.5-coder-qlora") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -6,14 +6,14 @@ colorTo: green
|
|
| 6 |
license: apache-2.0
|
| 7 |
base_model: Qwen/Qwen2.5-Coder-3B-Instruct
|
| 8 |
tags:
|
| 9 |
-
- text-to-sql
|
| 10 |
-
- wikisql
|
| 11 |
-
- qlora
|
| 12 |
-
- peft
|
| 13 |
-
- sql
|
| 14 |
-
- qwen
|
| 15 |
language:
|
| 16 |
-
- en
|
| 17 |
---
|
| 18 |
|
| 19 |
# WikiSQL Qwen2.5-Coder QLoRA
|
|
@@ -80,11 +80,13 @@ base_model = AutoModelForCausalLM.from_pretrained(
|
|
| 80 |
|
| 81 |
model = PeftModel.from_pretrained(base_model, adapter_name)
|
| 82 |
model.eval()
|
| 83 |
-
|
| 84 |
|
| 85 |
## Prompt Format
|
| 86 |
|
|
|
|
| 87 |
|
|
|
|
| 88 |
You are a text-to-SQL assistant. Return only the SQL query.
|
| 89 |
|
| 90 |
Table: 1-10015132-16
|
|
@@ -92,20 +94,23 @@ Columns: Player, No., Nationality, Position, Years in Toronto, School/Club Team
|
|
| 92 |
Question: What is terrence ross' nationality
|
| 93 |
|
| 94 |
SQL:
|
|
|
|
| 95 |
|
| 96 |
## Expected Output Format
|
| 97 |
-
SELECT Nationality FROM 1-10015132-16 WHERE Player = 'Terrence Ross'
|
| 98 |
-
|
| 99 |
|
|
|
|
| 100 |
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
Limitations
|
| 103 |
|
| 104 |
The main limitation of this model is that it was fine-tuned on WikiSQL-style single-table examples. Because of this, it may not generalize well to complex SQL tasks involving joins, nested queries, multiple tables, or unfamiliar database schemas. The model can still hallucinate column names or produce invalid SQL, especially if the prompt does not include enough schema information. The evaluation uses normalized exact-match accuracy, which is strict and may count logically similar SQL queries as incorrect if they differ in formatting, capitalization, or string values. Since this repository contains a QLoRA adapter, it should be loaded on top of the original Qwen2.5-Coder-3B-Instruct base model.
|
| 105 |
|
|
|
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
Evaluation library: lm-evaluation-harness
|
|
|
|
| 6 |
license: apache-2.0
|
| 7 |
base_model: Qwen/Qwen2.5-Coder-3B-Instruct
|
| 8 |
tags:
|
| 9 |
+
- text-to-sql
|
| 10 |
+
- wikisql
|
| 11 |
+
- qlora
|
| 12 |
+
- peft
|
| 13 |
+
- sql
|
| 14 |
+
- qwen
|
| 15 |
language:
|
| 16 |
+
- en
|
| 17 |
---
|
| 18 |
|
| 19 |
# WikiSQL Qwen2.5-Coder QLoRA
|
|
|
|
| 80 |
|
| 81 |
model = PeftModel.from_pretrained(base_model, adapter_name)
|
| 82 |
model.eval()
|
| 83 |
+
```
|
| 84 |
|
| 85 |
## Prompt Format
|
| 86 |
|
| 87 |
+
The model uses a direct instruction format. The prompt gives the model the table ID, column names, and natural-language question. The model is instructed to return only the SQL query.
|
| 88 |
|
| 89 |
+
```text
|
| 90 |
You are a text-to-SQL assistant. Return only the SQL query.
|
| 91 |
|
| 92 |
Table: 1-10015132-16
|
|
|
|
| 94 |
Question: What is terrence ross' nationality
|
| 95 |
|
| 96 |
SQL:
|
| 97 |
+
```
|
| 98 |
|
| 99 |
## Expected Output Format
|
|
|
|
|
|
|
| 100 |
|
| 101 |
+
The expected output is a single SQL query with no markdown formatting, no explanation, and no extra text.
|
| 102 |
|
| 103 |
+
```sql
|
| 104 |
+
SELECT Nationality FROM 1-10015132-16 WHERE Player = 'Terrence Ross'
|
| 105 |
+
```
|
| 106 |
|
| 107 |
+
## Limitations
|
| 108 |
|
| 109 |
The main limitation of this model is that it was fine-tuned on WikiSQL-style single-table examples. Because of this, it may not generalize well to complex SQL tasks involving joins, nested queries, multiple tables, or unfamiliar database schemas. The model can still hallucinate column names or produce invalid SQL, especially if the prompt does not include enough schema information. The evaluation uses normalized exact-match accuracy, which is strict and may count logically similar SQL queries as incorrect if they differ in formatting, capitalization, or string values. Since this repository contains a QLoRA adapter, it should be loaded on top of the original Qwen2.5-Coder-3B-Instruct base model.
|
| 110 |
|
| 111 |
+
## Citations and Links
|
| 112 |
|
| 113 |
+
- Base model: [`Qwen/Qwen2.5-Coder-3B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct)
|
| 114 |
+
- Dataset: [`mlx-community/wikisql`](https://huggingface.co/datasets/mlx-community/wikisql)
|
| 115 |
+
- PEFT library: [`peft`](https://huggingface.co/docs/peft/index)
|
| 116 |
+
- Evaluation library: [`lm-evaluation-harness`](https://github.com/EleutherAI/lm-evaluation-harness)
|
|
|