xlangai/spider
Viewer โข Updated โข 8.03k โข 8.49k โข 193
How to use Krsna444/text2sql-hinglish-lora with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "Krsna444/text2sql-hinglish-lora")LoRA adapter for Qwen/Qwen2.5-Coder-3B-Instruct, fine-tuned with QLoRA (Unsloth, rank 16, 1 epoch) on Spider train
plus 600 Hinglish-translated questions. Trained on a single RTX 4060 8 GB laptop GPU.
Code, evaluation scripts and demo app: https://github.com/KRSNA444/text2sql-hinglish
| Model | English (Spider dev, 1,034 q) | Hinglish (200 q) |
|---|---|---|
| Base Qwen2.5-Coder-3B-Instruct | 62.3% | 46.5% |
| Fine-tuned, English only | 72.2% | 55.5% |
| This adapter (English + 600 Hinglish) | 71.6% | 66.0% |
The model expects a system prompt, then a user message of the form:
Database schema:
CREATE TABLE singer (
singer_id number,
name text,
PRIMARY KEY (singer_id)
);
Question: Kitne singers hain?
SQL:
See common.py in the GitHub repo for the exact system prompt and schema formatter.
Dataset: Spider (Yu et al., 2018), CC BY-SA 4.0. Base model by Alibaba Qwen: check the base model's license before commercial use.
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-Coder-3B-Instruct-bnb-4bit") model = PeftModel.from_pretrained(base_model, "Krsna444/text2sql-hinglish-lora")