SQLGenie - LoRA Fine-Tuned LLaMA 3B for Text-to-SQL Generation
SQLGenie is a lightweight LoRA adapter fine-tuned on top of Unsloth’s 4-bit LLaMA 3 (3B) model. It is designed to convert natural language instructions into valid SQL queries with minimal compute overhead, making it ideal for integrating into data-driven applications,or chat interfaces. it has been trained over 100K types of text based on various different domains such as Education, Technical, Health and more
Model Details
Model Description
- Developed by: Merwin
- Model type: PEFT adapter (LoRA) for Causal Language Modeling
- Language(s): English
- License: Apache 2.0
- Fine-tuned from model: unsloth/llama-3.2-3b-unsloth-bnb-4bit
Model Sources
- Repository: https://huggingface.co//SQLGenie
Uses
Direct Use
This model can be directly used to generate SQL queries from natural language prompts. Example use cases include:
- Building AI assistants for databases
- Enhancing Query tools with NL-to-SQL capabilities
- Automating analytics queries in various domains
Bias, Risks, and Limitations
While the model has been fine-tuned for SQL generation, it may:
- Produce invalid SQL for a very few edge cases
- Infer incorrect table or column names not present in prompt
- Assume a generic SQL dialect (closer to MySQL/PostgreSQL Databases)
Recommendations
Always validate and test generated queries before execution in a production database.
How to Get Started with the Model
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model = AutoModelForCausalLM.from_pretrained(
"unsloth/llama-3.2-3b-unsloth-bnb-4bit",
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("unsloth/llama-3.2-3b-unsloth-bnb-4bit")
model = PeftModel.from_pretrained(base_model, "mervp/SQLGenie")
prompt = "List the customers from Canada."
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
#
OR
#
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="mervp/SQLGenie",
max_seq_length=2048,
dtype=None,
# load_in_4bit=True,
)
- Downloads last month
- 9
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support