File size: 1,340 Bytes
3485f2f
fbd1e85
01c7c85
 
 
 
 
 
 
fbd1e85
01c7c85
fbd1e85
 
01c7c85
fbd1e85
01c7c85
fbd1e85
 
01c7c85
 
 
 
fbd1e85
01c7c85
fbd1e85
01c7c85
 
fbd1e85
01c7c85
 
fbd1e85
01c7c85
 
 
 
fbd1e85
01c7c85
 
 
 
fbd1e85
01c7c85
 
 
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

---
license: apache-2.0
base_model: codellama/CodeLlama-7b-Instruct-hf
tags:
- text-to-sql
- spider-dataset
- sqlifyai
- code-generation
library_name: transformers
pipeline_tag: text-generation
---

# SQLifyAI - Text-to-SQL Model

This model was fine-tuned using SQLifyAI on the Spider dataset for converting natural language questions to SQL queries.

## Model Details
- **Base Model**: codellama/CodeLlama-7b-Instruct-hf
- **Dataset**: Spider
- **Training**: Multi-stage curriculum learning with advanced schema linking
- **Commit**: 30-minute rapid test training run

## Usage

```python
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("dattheshshenoy/sqlifyai-30min-test")
model = AutoModelForCausalLM.from_pretrained("dattheshshenoy/sqlifyai-30min-test")

# Generate SQL
question = "What are the names of all students?"
schema = "CREATE TABLE students (id INT, name VARCHAR(50));"
prompt = f"### Question: {question}\n### Schema: {schema}\n### SQL:"

inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=128)
sql = tokenizer.decode(outputs[0], skip_special_tokens=True).split("### SQL:")[-1].strip()
```

## Performance
- Trained with advanced schema linking and curriculum learning
- Optimized for Spider dataset evaluation metrics