The code for evaluation is adapted from Spider official evaluation script, while the code for converting NatSQL to SQL is from NatSQL codebase. There are in total five evaluation sets from Spider-CG - Spider-dev
, CG-APP(T)
, CG-APP(D)
, CG-SUB(T)
, and CG-SUB(D)
. More details about the dataset on the paper.
Follow all instructions on the project homepage to set up the Python virtual environment and install all dependencies.
- Download the datasets and copy all the test sets from the
./data/
of the downloaded folder to the./data/
of the project directory. - Download the Spider dataset and copy the
database
folder andtables.json
to the./data/
of the project directory.
Run the inference code using the script below to get the prediction of the test set using the selected checkpoint.
Note: Please use --token_preprocessing only if your model is trained with our token preprocessing input.
python evaluation/inference.py --checkpoint checkpoint_path --data test_data_path --database database_path --token_preprocessing
Evaluate the predicted SQL to get the exact match accuracy (EX) and execution accuracy (EX). This code is adapted from Spider official evaluation script.
python evaluation/evaluation.py --gold gold_test_file_path --pred pred.sql --etype all --db database_path --table data/tables.json