該存儲庫包含ACL 2020紙的代碼“ RAT-SQL:與文本到SQL Parsers”的編碼和鏈接。
如果您在工作中使用RAT-SQL,請如下引用:
@inproceedings { rat-sql ,
title = " {RAT-SQL}: Relation-Aware Schema Encoding and Linking for Text-to-{SQL} Parsers " ,
author = " Wang, Bailin and Shin, Richard and Liu, Xiaodong and Polozov, Oleksandr and Richardson, Matthew " ,
booktitle = " Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics " ,
month = jul,
year = " 2020 " ,
address = " Online " ,
publisher = " Association for Computational Linguistics " ,
pages = " 7567--7578 "
}2020-08-14:
下載數據集:蜘蛛和Wikisql。如果蜘蛛,請確保下載08/03/2020版本或更新。在此項目之外的某個地方打開數據集,以創建以下目錄結構:
/path/to/data
├── spider
│ ├── database
│ │ └── ...
│ ├── dev.json
│ ├── dev_gold.sql
│ ├── tables.json
│ ├── train_gold.sql
│ ├── train_others.json
│ └── train_spider.json
└── wikisql
├── dev.db
├── dev.jsonl
├── dev.tables.jsonl
├── test.db
├── test.jsonl
├── test.tables.jsonl
├── train.db
├── train.jsonl
└── train.tables.jsonl
要使用WikisQL數據集,請將其評估腳本克隆到該項目中:
mkdir -p third_party
git clone https://github.com/salesforce/WikiSQL third_party/wikisql我們提供了一個為您設置整個環境的Dockerfile 。它假設您將下載的數據集安裝在步驟1中,將其作為卷/mnt/data插入運行映像中。因此,RAT-SQL的環境設置為:
docker build -t ratsql .
docker run --rm -m4g -v /path/to/data:/mnt/data -it ratsql請注意,圖像需要至少4 GB的RAM才能進行預處理。默認情況下,用於Mac的Docker桌面和Windows運行容器的Docker Desktop帶有2 GB的RAM。 -m4g開關覆蓋它;另外,您可以增加Docker桌面設置中的默認限制。
如果您希望在沒有Docker的情況下設置並運行代碼庫,請按照
DockerfileOne中的步驟進行操作。請注意,此存儲庫需要3.7或更高的Python和JVM才能運行Stanford Corenlp。
每個實驗在experiments中都有自己的配置文件。使用任何模型版本或數據集的管道是:
python run.py preprocess experiment_config_file # Step 3a: preprocess the data
python run.py train experiment_config_file # Step 3b: train a model
python run.py eval experiment_config_file # Step 3b: evaluate the results使用以下實驗配置文件重現我們的結果:
experiments/spider-glove-run.jsonnetexperiments/spider-bert-run.jsonnetexperiments/wikisql-glove-run.jsonnet確切的模型準確性可能會因隨機種子而異±2%。有關詳細信息,請參見紙。
該項目歡迎貢獻和建議。大多數捐款要求您同意撰寫貢獻者許可協議(CLA),宣布您有權並實際上授予我們使用您的貢獻的權利。有關詳細信息,請訪問https://cla.opensource.microsoft.com。
當您提交拉動請求時,CLA機器人將自動確定您是否需要提供CLA並適當裝飾PR(例如狀態檢查,評論)。只需按照機器人提供的說明即可。您只需要使用我們的CLA在所有存儲庫中進行一次。
該項目採用了Microsoft開源的行為代碼。有關更多信息,請參見《行為守則常見問題守則》或與其他問題或評論聯繫[email protected]。