Code Monkey home page Code Monkey logo

sqlnet's Introduction

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

sqlnet's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.