该存储库包含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]。