ContextualSP/awakening_latent_grounding
SivilTaram 984a7647df Update the README. 2023-05-06 23:54:21 +08:00
..
data Update the json data. 2023-05-06 23:50:44 +08:00
models Update files for WTQ grounding code. Merge different branches to reproduce all experimental results. 2022-12-18 13:47:58 +08:00
scripts Update files for WTQ grounding code. Merge different branches to reproduce all experimental results. 2022-12-18 13:47:58 +08:00
utils Update files for WTQ grounding code. Merge different branches to reproduce all experimental results. 2022-12-18 13:47:58 +08:00
README.md Update the README. 2023-05-06 23:54:21 +08:00
distill.py update the final version of code of grounding. 2022-12-17 00:47:13 +08:00
eval.py Update files for WTQ grounding code. Merge different branches to reproduce all experimental results. 2022-12-18 13:47:58 +08:00
eval_spider_ground.sh Update files for WTQ grounding code. Merge different branches to reproduce all experimental results. 2022-12-18 13:47:58 +08:00
eval_wtq_ground.sh Update files for WTQ grounding code. Merge different branches to reproduce all experimental results. 2022-12-18 13:47:58 +08:00
predict.py update the final version of code of grounding. 2022-12-17 00:47:13 +08:00
requirements.txt update the final version of code of grounding. 2022-12-17 00:47:13 +08:00
train.py Update files for WTQ grounding code. Merge different branches to reproduce all experimental results. 2022-12-18 13:47:58 +08:00
train_spider_ground.sh Use fewer epochs to train the model 2022-12-19 12:13:41 +08:00
train_wtq_ground.sh Use fewer epochs to train the model 2022-12-19 12:13:41 +08:00

README.md

README

The official code of paper Awakening Latent Grounding from Pretrained Language Models for Semantic Parsing.

Install Dependencies

Please first install PyTorch, and then install all the dependencies by running:

pip install -r requirements.txt

Please remember to unzip the json.zip in the data/wtq_grounding folder. And the file structure should be like:

data/wtq_grounding
├── json
│   ├── 202.json
│   ├── 203.json
│   ├── ...
├── dev.json
├── test.json
└── ...

Train Grounding Model

Train Grounding Model on Spider

Please run the script train_spider_ground.sh to train the grounding model on Spider dataset.

Train Grounding Model on WTQ

Please run the script train_wtq_ground.sh to train the grounding model on WTQ dataset.

Evaluate Grounding Model

Evaluate Grounding Model on Spider

Please run the script eval_spider_ground.sh to evaluate the grounding model on Spider dataset. Note that you should replace the model checkpoint checkpoints/spider_grounding_model/model.pt with yours.

You should get the following results after following the training script:

avg loss = 0.2189                                                                                                 
table accuracy = 0.8453                                                                                           
column accuracy = 0.7602                                                                                          
value accuracy = 0.9449                                                                                           
overall accuracy = 0.7050                                                                                         
table  P = 0.847, R = 0.857, F1 = 0.852                                                                           
column  P = 0.842, R = 0.838, F1 = 0.840                                                                          
value  P = 0.948, R = 0.932, F1 = 0.940                                                                           
average F1 = 0.8773                                                                                               

Evaluate Grounding Model on WTQ

Please run the script eval_wtq_ground.sh to evaluate the grounding model on WTQ dataset. Note that you should replace the model checkpoint checkpoints/wtq_grounding_model/model.pt with yours.