This repo provides an implementation of SQLNet and Seq2SQL neural networks for predicting SQL queries on [WikiSQL dataset](https://github.com/salesforce/WikiSQL). The paper is available at [here](https://arxiv.org/abs/1711.04436).
Project description
SQLNet
This repo provides an implementation of SQLNet and Seq2SQL neural networks for predicting SQL queries on WikiSQL dataset. The paper is available at here.
Citation
Xiaojun Xu, Chang Liu, Dawn Song. 2017. SQLNet: Generating Structured Queries from Natural Language Without Reinforcement Learning.
Bibtex
@article{xu2017sqlnet,
title={SQLNet: Generating Structured Queries From Natural Language Without Reinforcement Learning},
author={Xu, Xiaojun and Liu, Chang and Song, Dawn},
journal={arXiv preprint arXiv:1711.04436},
year={2017}
}
Installation
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
Downloading the glove embedding.
Download the pretrained glove embedding from here using
bash download_glove.sh
Extract the glove embedding for training.
Run the following command to process the pretrained glove embedding for training the word embedding:
python extract_vocab.py
Train
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 SQLNet model with column attention:
python train.py --ca
Train a SQLNet model with column attention and trainable embedding (requires pretraining without training embedding, i.e., executing the command above):
python train.py --ca --train_emb
Pretrain a Seq2SQL model on the re-splitted dataset
python train.py --baseline --dataset 1
Train a Seq2SQL model with Reinforcement Learning after pretraining
python train.py --baseline --dataset 1 --rl
Test
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 SQLNet model with column attention
python test.py --ca
Test a trained SQLNet model with column attention and trainable embedding:
python test.py --ca --train_emb
Test a trained Seq2SQL model withour RL on the re-splitted dataset
python test.py --baseline --dataset 1
Test a trained Seq2SQL model with Reinforcement learning
python test.py --baseline --dataset 1 --rl
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sqlnet_predict-0.1.0.tar.gz
.
File metadata
- Download URL: sqlnet_predict-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-45-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab5408886ac2bda2baf972f39366470dd088270b20e456e835fca8f89a108836 |
|
MD5 | 3f4db8106e95ff2d0522fc314c66ffea |
|
BLAKE2b-256 | 0d15b96a3d181611af13c7baa9970320d321e953a6b370c785aa2a1c73e0267e |
File details
Details for the file sqlnet_predict-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: sqlnet_predict-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-45-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 166f04c3b18abf4519272b7f5af18431d1dc26cf5385b8633a89bd6f3fa48323 |
|
MD5 | e6d9de851bf76fe1cec3971edc637ccf |
|
BLAKE2b-256 | 1d55f455b956cbed827c30f410699ec79b509416df02b4a8e2f635611da7745d |