allenai / allennlp

An open-source NLP research library, built on PyTorch.
http://www.allennlp.org
Apache License 2.0
11.76k stars 2.25k forks source link

train model for text2sql #3117

Closed Bipin8469 closed 5 years ago

Bipin8469 commented 5 years ago

System (please complete the following information):

OS: Windows 10 pro Python version: 3.6.8 AllenNLP version: allennlp 0.8.4-unreleased PyTorch version: 1.1.0

Question I was following the example on link https://demo.allennlp.org/atis-parser. I have gone through it and find it very interesting. I need your help in understanding the possibility of training this functionality for custom tables. for eg. if I have a set of 10 tables (with relationships, primary keys etc. ) how can I train the model with those tables and generate a model for the same. many thanks for the help in advance.

kernelmachine commented 5 years ago

I would take a look at the dataset readers for the atis parser and text2sql template. Make sure your data is in a compatible format to be read by these dataset readers, and the associated models should work out of the box. Let us know if you have any further specific questions about training your text2sql model.

Bipin8469 commented 5 years ago

hi, @kernelmachine thanks for your answer. I've to go through https://github.com/allenai/allennlp/issues/3022 this issue. now I knew what file and what data I have to. but I don't understand how I replace with my data.

1) First is database allennlp/tests/fixtures/data/text2sql/restaurants.db that i replace with my database.

2) second is sample file allennlp/tests/fixtures/data/atis/sample.json. that is for validation and training. but not know to replace with what?

3) third is allennlp/tests/fixtures/semantic_parsing/atis/experiment.json don't for what.

4) found two more files in allennlp/tests/fixtures/data/text2sql allennlp/tests/fixtures/data/text2sql/restaurants-schema.csv AND allennlp/tests/fixtures/data/text2sql/restaurants_tiny.json

5) training_config\atis_train.json don't know and the main question is that, how I consider that all files in command

thank you in advance.

DeNeutoy commented 5 years ago

This code is complex and designed for research. The information in #3022 should point you to how to begin writing a grammar and formatting training data for another database/domain, but unfortunately we aren't going to be able to help you through the whole process, because it's complicated. If you are looking for a practical solution, I would advise you to look at other sequence to sequence type models rather than the grammar based semantic parsing code in allennlp.

If you are looking to do research into this, you might find this guide helpful:

https://github.com/allenai/allennlp/blob/master/tutorials/getting_started/semantic_parsing.md