Git Product home page Git Product logo

c3sql's Introduction

C3SQL

The code for the paper C3: Zero-shot Text-to-SQL with ChatGPT (https://arxiv.org/abs/2307.07306)

Prepare Spider Data

Download spider data and database (only spider original database right now) and then unzip them:

mkdir data 
unzip spider.zip 
mv spider/database . 
mv spider data

Run Inference

Run the command below, and the predicted sql will be save to the file named "predicted_sql.txt"

bash run_c3sql.sh 

Run evaluation

Add your openai key in the generate_sqls_by_gpt3.5.py, column_recall.py, table_recall.py files.

openai.api_key = "your_api_key"

Clone evaluation scripts (test-suite-sql-eval:https://github.com/taoyds/test-suite-sql-eval):

mkdir third_party
cd third_party
git clone https://github.com/taoyds/test-suite-sql-eval
cd ..

Put the 'predicted_sql.txt' in the current directory.

Then you can run evaluation with following command, and you will see the results on dev data.
For testing, you just need to replace 'dev_gold.sql' with your test data, folder 'database' with your database and 'spider/tables.json' with your test tables.json.

python third_party/test-suite-sql-eval/evaluation.py --gold dev_gold.sql --pred predicted_sql.txt --db database --table data/spider/tables.json --etype all 

c3sql's People

Contributors

bigbigwatermalon avatar xm-dong 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.