xlangai/spider
Viewer β’ Updated β’ 8.03k β’ 8.92k β’ 174
This model is a fine-tuned T5-Small architecture specialized for converting Natural Language questions into precise PostgreSQL queries. It serves as the primary "Reasoning Specialist" within the NLP2SQL Autonomous Intelligence Layer.
This model is designed to work in tandem with Large Language Models (like Gemini 2.0 Flash) in a structured multi-agent workflow:
This model is the engine for the NLP2SQL Platform.
from transformers import T5Tokenizer, T5ForConditionalGeneration
model_name = "Karan6124/t5-nl2sql-gen"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)
input_text = "translate English to SQL: How many users signed up in the last 30 days? \n Context: Table users (id, username, created_at)"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))