| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| .gitattributes | 1.52 kB xet | 818ba6de | |
| README.md | 2.19 kB xet | c0d65615 | |
| adapter_config.json | 987 Bytes xet | 99014388 | |
| adapter_model.safetensors | 4.52 MB xet | 680b1fc5 | |
| chat_template.jinja | 410 Bytes xet | 3aeadfe5 | |
| tokenizer.json | 3.62 MB xet | f9a530a1 | |
| tokenizer_config.json | 363 Bytes xet | 474ebf3e | |
| training_args.bin | 5.65 kB xet | 57e837b9 |
Text-to-SQL TinyLlama LoRA Adapter
A fine-tuned LoRA adapter that converts natural language questions into SQL queries. Built on top of TinyLlama-1.1B-Chat-v1.0 using Supervised Fine-Tuning (SFT) on the Spider benchmark dataset.
Model Details
Model Description
This is a LoRA (Low-Rank Adaptation) adapter fine-tuned to generate SQL queries from natural language questions. Only 0.10% of the base model's parameters were trained, making it extremely lightweight (4.5 MB) while still achieving strong results.
- Developed by: Rj18
- Model type: Causal Language Model (LoRA Adapter)
- Language(s): English
- License: MIT
- Fine-tuned from: TinyLlama/TinyLlama-1.1B-Chat-v1.0
Model Sources
How to Use
import torch from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel
Load base model and tokenizer
base_model = "TinyLlama/TinyLlama-1.1B-Chat-v1.0" adapter = "Rj18/text-to-sql-tinyllama-lora"
tokenizer = AutoTokenizer.from_pretrained(adapter) model = AutoModelForCausalLM.from_pretrained(base_model, torch_dtype=torch.float16) model = PeftModel.from_pretrained(model, adapter) model.eval()
Generate SQL
question = "How many employees are in each department?" prompt = f"[INST] Generate SQL for the following question.\nQuestion: {question} [/INST]\n"
inputs = tokenizer(prompt, return_tensors="pt") with torch.no_grad(): outputs = model.generate(**inputs, max_new_tokens=128, temperature=0.1)
sql = tokenizer.decode(outputs[0], skip_special_tokens=True) print(sql)
- Total size
- 8.15 MB
- Files
- 8
- Last updated
- Aug 9
- Pre-warmed CDN
- US EU US EU