Views
No views yet
gretelai/synthetic_text_to_sql dataset and can provide both SQL queries and table schema context when needed.transformers library as shown below:1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3tokenizer = AutoTokenizer.from_pretrained("Ellbendls/Qwen-2.5-3b-Text_to_SQL")
4model = AutoModelForCausalLM.from_pretrained("Ellbendls/Qwen-2.5-3b-Text_to_SQL")
5
6# Input prompt
7query = "What is the total number of hospital beds in each state?"
8
9# Tokenize input and generate output
10inputs = tokenizer(query, return_tensors="pt")
11outputs = model.generate(**inputs, max_length=512)
12
13# Decode and print
14print(tokenizer.decode(outputs[0], skip_special_tokens=True))What is the total number of hospital beds in each state?1Context:
2CREATE TABLE Beds (State VARCHAR(50), Beds INT);
3INSERT INTO Beds (State, Beds) VALUES ('California', 100000), ('Texas', 85000), ('New York', 70000);
4
5SQL Query:
6SELECT State, SUM(Beds) FROM Beds GROUP BY State;gretelai/synthetic_text_to_sql dataset, which includes diverse natural language queries mapped to SQL queries, with optional schema contexts.