Downloads · 30 days
5
33% of all-time downloads
harsheetakhandelwal/bidirectional-sql-converter
bidirectional-sql-converter is a machine learning model from harsheetakhandelwal. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
license: apache-2.0 language: - en - sql datasets: - wikisql tags: - text2text-generation - t5 - sql ---
Downloads · 30 days
5
33% of all-time downloads
All-time downloads
15
Public
Parameters
60.5M
243 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors242 MB · 100%
From the Hugging Face model README
license: apache-2.0 language:
This is a fine-tuned version of the t5-small model, specifically trained to perform bidirectional translation between natural language questions (English) and SQL queries.
This model was trained on the WikiSQL dataset as part of a portfolio project. The entire training process is documented in the accompanying Google Colab notebook.
This single model can perform two distinct tasks based on the prefix provided:
You can use this model directly with the transformers library pipeline.
from transformers import T5ForConditionalGeneration, T5Tokenizer
model_name = "your-hf-username/bidirectional-sql-converter"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)
question = "What is the nationality of the player from duke?"
input_text = "translate English to SQL: " + question
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=128)
generated_sql = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_sql)
# Expected output: SELECT Nationality FROM table WHERE School/Club Team = Duke
from transformers import T5ForConditionalGeneration, T5Tokenizer
model_name = "your-hf-username/bidirectional-sql-converter"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)
sql_query = "SELECT Nationality FROM table WHERE School/Club Team = Duke"
input_text = "translate SQL to English: " + sql_query
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=128)
generated_question = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_question)
# Expected output: What is the nationality of the player from Duke?
t5-small