Skip to content

hxviet/text2sql

Repository files navigation

text2sql

Prerequisites

Install required modules and tools:

pip install -r requirements.txt
pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.2.0/en_core_web_sm-2.2.0.tar.gz
python nltk_downloader.py

Prepare data

Download data and database and then unzip them:

unzip data.zip
unzip database.zip

SQLNet

Train Models

  mkdir saved_models
  python train.py --dataset data/

Test Models

python test.py --dataset data/ --output predicted_sql.txt

RESDSQL

Train Models

RESDSQL-{Base}

# Step1: preprocess dataset
sh scripts/train/text2sql/preprocess.sh
# Step2: train cross-encoder
sh scripts/train/text2sql/train_text2sql_schema_item_classifier.sh
# Step3: prepare text-to-sql training and development set for T5
sh scripts/train/text2sql/generate_text2sql_dataset.sh
# Step4: fine-tune T5-Base (RESDSQL-Base)
sh scripts/train/text2sql/train_text2sql_t5_base.sh

Test Models

sh scripts/inference/infer_text2natsql.sh base spider

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •