Instructions to use parkervg/destt5-text2sql with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use parkervg/destt5-text2sql with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("parkervg/destt5-text2sql") model = AutoModelForSeq2SeqLM.from_pretrained("parkervg/destt5-text2sql", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| language: | |
| - en | |
| tags: | |
| - text2sql | |
| datasets: | |
| - splash | |
| widget: | |
| - text: "Give the name, population, and head of state for the country that has the largest area. || select name, population, continent from country order by surfacearea desc limit 1 || world_1 | country : name, population, headofstate, surfacearea || swap continent with head of state because it is not required." | |
| ## parkervg/destt5-text2sql | |
| Fine-tuned weights for the text2sql model described in [Correcting Semantic Parses with Natural Language through Dynamic | |
| Schema Encoding](https://arxiv.org/pdf/2305.19974.pdf), based on [t5-base](https://huggingface.co/t5-base). | |
| ### Training Data | |
| The model has been fine-tuned on the 7,481 training examples in the [SPLASH interactive semantic parsing dataset](https://github.com/MSR-LIT/Splash). | |
| Rather than seeing the full database schema, it only received the filtered schema as predicted by the [destt5-schema-prediction model](https://huggingface.co/parkervg/destt5-schema-prediction) | |
| ### Training Objective | |
| This model was initialized with [t5-base](https://huggingface.co/t5-base) and fine-tuned with the text-to-text generation objective. | |
| As this model works in the interactive setting, we utilize the standard text2sql features such as `question` and `db_schema`, in addition to `feedback` and `incorrect_parse`. | |
| Importantly, the `[table]`, `[column]`, `[content]` features are expected to be the 'gold' schema items, as predicted by an initial auxiliary schema prediction model. | |
| ``` | |
| [question] || [incorrect_parse] || [db_id] | [table] : [column] ( [content] , [content] ) , [column] ( ... ) , [...] | [table] : ... | ... || [feedback] | |
| ``` | |
| The model then attempts to parse the corrected SQL query, using the filtered database schema items. This is prefaced by the `db_id`. | |
| ``` | |
| [db_id] | [sql] | |
| ``` | |
| ### Performance | |
| When this model receives the serialized database schema as predicted by [destt5-schema-prediction](https://huggingface.co/parkervg/destt5-schema-prediction), it achieves 53.43% correction accuracy (exact-match) on the SPLASH test set. | |
| ### References | |
| 1. [Correcting Semantic Parses with Natural Language through Dynamic | |
| Schema Encoding](https://arxiv.org/pdf/2305.19974.pdf) | |
| 2. [DestT5 codebase](https://github.com/parkervg/destt5) | |
| 3. [Speak to your Parser: Interactive Text-to-SQL with Natural Language Feedback](https://arxiv.org/pdf/2005.02539v2.pdf) | |
| ### Citation | |
| ```bibtex | |
| @inproceedings{glenn2023correcting, | |
| author = {Parker Glenn, Parag Pravin Dakle, Preethi Raghavan}, | |
| title = "Correcting Semantic Parses with Natural Language through Dynamic Schema Encoding", | |
| booktitle = "Proceedings of the 5th Workshop on NLP for Conversational AI", | |
| publisher = "Association for Computational Linguistics", | |
| year = "2023" | |
| } | |
| ``` | |