Views
No views yet
Salesforce/codet5-smallq and v modules.question: <QUESTION> table: <TABLE_HEADERS>1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3# Replace with your actual HF repo name
4model_name = "Mahendra1742/SqlGPT"
5
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
8
9# Example input
10question = "How many employees are in the Marketing department?"
11table = "| department | employees |"
12
13prompt = f"question: {question} table: {table}"
14
15inputs = tokenizer(prompt, return_tensors="pt")
16
17outputs = model.generate(**inputs, max_length=128)
18
19print("OUTPUT :- ")
20print(" ")
21print(tokenizer.decode(outputs[0], skip_special_tokens=True))
22question: How many cities have a population over 1 million? table: | City | Population |
SELECT COUNT(*) FROM table WHERE Population > 1000000