|
|
---
|
|
|
language: en
|
|
|
datasets: custom
|
|
|
tags:
|
|
|
- text-to-sql
|
|
|
- t5
|
|
|
- natural-language-processing
|
|
|
- transformers
|
|
|
- huggingface
|
|
|
license: apache-2.0
|
|
|
---
|
|
|
|
|
|
# 🔍 Text-to-SQL with T5 (`t5-base`)
|
|
|
|
|
|
This model is a fine-tuned version of [`t5-base`](https://huggingface.co/t5-base) on a custom **Text-to-SQL** dataset. It translates natural language questions into corresponding SQL queries.
|
|
|
|
|
|
## 📌 Model Details
|
|
|
|
|
|
- **Base model:** [t5-base](https://huggingface.co/t5-base)
|
|
|
- **Task:** Natural Language to SQL (text-to-SQL)
|
|
|
- **Dataset:** Small custom dataset (~10–15 examples) of questions and SQL queries
|
|
|
- **Language:** English
|
|
|
- **Fine-tuned by:** [Priyanshu05](https://huggingface.co/Priyanshu05)
|
|
|
|
|
|
## 🧠 Example
|
|
|
|
|
|
```python
|
|
|
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
|
|
|
|
|
model = T5ForConditionalGeneration.from_pretrained("Priyanshu05/text-to-sql-t5")
|
|
|
tokenizer = T5Tokenizer.from_pretrained("Priyanshu05/text-to-sql-t5")
|
|
|
|
|
|
question = "translate natural language to SQL: show all customers"
|
|
|
inputs = tokenizer(question, return_tensors="pt")
|
|
|
output = model.generate(**inputs)
|
|
|
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
|
|
|
|
|
|
|
|
## 📊 Training Details
|
|
|
- Epochs: 3
|
|
|
|
|
|
- Batch Size: 8
|
|
|
|
|
|
- Learning Rate: 5e-5
|
|
|
|
|
|
- Optimizer: AdamW
|
|
|
|
|
|
- Loss Function: Cross Entropy
|
|
|
|
|
|
- Logged with: Weights & Biases
|
|
|
|
|
|
## 📁 Files
|
|
|
pytorch_model.bin or model.safetensors: The fine-tuned model
|
|
|
|
|
|
tokenizer_config.json, spiece.model: Tokenizer files
|
|
|
|
|
|
config.json: Model architecture
|
|
|
|
|
|
## 🚀 Intended Use
|
|
|
Educational and experimental use
|
|
|
|
|
|
Translate natural language questions into basic SQL queries
|
|
|
|
|
|
|
|
|
## 📜 License
|
|
|
Apache 2.0
|
|
|
|