YAML Metadata
Warning:
The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
Text-to-SQL T5 Model (16pramodh/t2s_model
)
Model Description
This is a T5-based text-to-SQL model trained to convert natural language questions into SQL queries.
It works by taking in:
natural language query [SEP] table schema
and producing a SQL statement based on the provided database schema.
The model is based on T5ForConditionalGeneration
and supports text2text-generation via the Hugging Face Inference API.
Intended Use
- Input: English natural language question plus the database schema.
- Output: SQL query that can be executed on the described database.
Example
Input: Get the names and emails of all customers who signed up after January 1, 2024 [SEP] CREATE TABLE customers (customer_id INT PRIMARY KEY, name VARCHAR(50), email VARCHAR(100), signup_date DATE);
Output: SELECT name, email FROM customers WHERE signup_date > '2024-01-01';
How to Use
Hugging Face Inference API
curl -X POST \
-H "Authorization: Bearer YOUR_HF_TOKEN" \
-H "Content-Type: application/json" \
-d '{"inputs": "Get the names and emails of all customers who signed up after January 1, 2024 [SEP] CREATE TABLE customers (customer_id INT PRIMARY KEY, name VARCHAR(50), email VARCHAR(100), signup_date DATE);"}' \
https://api-inference.huggingface.co/models/16pramodh/t2s_model
Python (Transformers)
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
model_name = "16pramodh/t2s_model"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
input_text = "Get the names and emails of all customers who signed up after January 1, 2024 [SEP] CREATE TABLE customers (customer_id INT PRIMARY KEY, name VARCHAR(50), email VARCHAR(100), signup_date DATE);"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 18
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support
Model tree for 16pramodh/t2s_model
Base model
Salesforce/codet5-base