Views
No views yet

1from transformers import pipeline, AutoTokenizer
2
3question = "how to get all employees from table0"
4prompt = f'Your task is to create SQL query of the following {question}, just SQL query and no text'
5
6tokenizer = AutoTokenizer.from_pretrained("samadpls/querypls-prompt2sql")
7pipe = pipeline(task='text-generation', model="samadpls/querypls-prompt2sql", tokenizer=tokenizer, max_length=200)
8
9result = pipe(prompt)
10print(result[0]['generated_text'])question variable with the desired question, and the generated SQL query will be printed.1Step Training Loss Validation Loss
2943 2.332100 2.652054
31886 2.895300 2.551685
42829 2.427800 2.498556
53772 2.019600 2.472013
64715 3.391200 2.465390However, note that the model may be too large to load in certain environments.