This repo provides an implementation of our neural networks for predicting SQL queries on WikiSQL dataset. Our paper is available at here.
Tong Guo, Huilin Gao. 2018. Bidirectional Attention for SQL Generation.
@article{guo2018bidirectional,
title={Bidirectional Attention for SQL Generation},
author={Guo, Tong and Gao, Huilin},
journal={arXiv preprint arXiv:1801.00076},
year={2018}
}
The data is in data.tar.bz2
. Unzip the code by running
tar -xjvf data.tar.bz2
The code is written using PyTorch in Python 2.7. Check here to install PyTorch. You can install other dependency by running
pip install -r requirements.txt
Download the pretrained glove embedding from here using
bash download_glove.sh
Run the following command to process the pretrained glove embedding for training the word embedding:
python extract_vocab.py
The training script is train.py
. To see the detailed parameters for running:
python train.py -h
Some typical usage are listed as below:
Train a model with bi-attention:
python train.py --ca
Train a model with column attention and trainable embedding (requires pretraining without training embedding, i.e., executing the command above):
python train.py --ca --train_emb
The script for evaluation on the dev split and test split. The parameters for evaluation is roughly the same as the one used for training. For example, the commands for evaluating the models from above commands are:
Test a trained model with column attention
python test.py --ca
Test a trained model with column attention and trainable embedding:
python test.py --ca --train_emb