samadpls/querypls-prompt2sql
625
1---2pipeline_tag: text-generation3---4 5 6<img src='https://cdn-uploads.huggingface.co/production/uploads/648dd721b91c3ead953a5ae0/zUj6oxW4WHXQjFHYhTduY.png' align='center'>7 8# ๐ข๐ฌ Querypls-Prompt2SQL9 10 11 12## Overview13 14Querypls-Prompt2SQL is a ๐ฌ text-to-SQL generation model developed by [samadpls](https://github.com/samadpls). It is designed for generating SQL queries based on user prompts.15 16## Model Usage17 18To get started with the model in Python, you can use the following code:19 20```python21from transformers import pipeline, AutoTokenizer22 23question = "how to get all employees from table0"24prompt = f'Your task is to create SQL query of the following {question}, just SQL query and no text'25 26tokenizer = AutoTokenizer.from_pretrained("samadpls/querypls-prompt2sql")27pipe = pipeline(task='text-generation', model="samadpls/querypls-prompt2sql", tokenizer=tokenizer, max_length=200)28 29result = pipe(prompt)30print(result[0]['generated_text'])31```32 33Adjust the `question` variable with the desired question, and the generated SQL query will be printed.34 35## Training Details36 37The model was trained on Google Colab, and its purpose is to be used in the [Querypls](https://github.com/samadpls/Querypls) project with the following training and validation loss progression:38 39```yaml40Step Training Loss Validation Loss41943 2.332100 2.652054421886 2.895300 2.551685432829 2.427800 2.498556443772 2.019600 2.472013454715 3.391200 2.46539046```47`However, note that the model may be too large to load in certain environments.`48 49For more information and details, please refer to the provided [documentation](https://huggingface.co/stabilityai/StableBeluga-7B).50 51 52## Model Card Authors53 54- ๐ค [samadpls](https://github.com/samadpls)